I am using Databin in a FormFunction and would like to check whether the DatabinAdd[] was successful. If it is not I get a \$Failed but I am unable to check for it. Opening the non existing Databin err = Databin["13X7XXXJH"] will result in an error and the output Failed. As expected. Using FailureQ[err] gives however the wrong result False.

err === $Failed

Results also in False, while

err == $Failed

Results in \$Failed == \$Failed.

How can I check whether a Databin command has been successful?


1 Answer 1


Databin does not evaluate when the bin does not exist. Calling it with an invalid id

err = Databin["13X7XXXJH"]

does not result in err=$Failure as one might expect but rather remains unevaluated as Databin["13X7XXXJH"] and calling err again results in the at this point already issued error message. For checking validity of a bin this is as discovered in this question rather unpleasant. I tried using Check, FailureQ, etc. without success. To be honest I am not sure if Databin is implemented correctly/properly in this regard because the output after Databin::apierr strongly suggests err=$Failure.

I proceed by looking under the hood of Databin using PrintDefinitions from the GeneralUtilities package and I found the subroutine which checks id strings for validity:


evaluates to $Failed with the specific error message Databin::nobin. Using getBinID one can define


which returns a complete UUID string if s is the id of an existing Databin and $Failed (without printing and error message) if s is invalid. One might use StringQ or FailureQ on the result to check it. Another option would be to use something like


to return (or call) failexpr directly from within DatabinCheck.

Using the internal method getBinID might introduce some overhead and might not be very robust (given that it is an internal function which might/is change/d in future/past versions). Catching the Databin::apierr thrown by Databin itself seems much more elegant but I could not get this to work as discussed earlier.

  • $\begingroup$ Thanks for your help. I suspect that FailureQ not working is a bug with Databin. I don't think I can use internals as the form is deployed to the cloud. I will try however. $\endgroup$
    – Matariki
    Apr 28, 2022 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.