You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently if FileMaker server returns an error an exception of type FileMakerError is raised. The same exception is used for all error types.
The problem that I am finding is that I now have to parse a lengthy text string to determine what the error actually was. In many instances this wouldn't be an issues, since it's likely to be fatal to the program execution and I'd need to log the exception (for example) and then provide some generic error response.
There are however times when you want to catch a specific error and behave differently for those. Immediate use cases I'm dealing with are
no records (401)
validation failed (503 - 507)
Would it be possible to either raise alternative exceptions for these errors, or expose the error code in the current exception?
The text was updated successfully, but these errors were encountered:
Currently, everything is a FileMakerError, but you can already get the error code directly from the Server.last_error property (returns an int, no need to parse text).
By the way: the last script result is also always accessible through the last_script_result property.
Having separate exceptions (at least for the common cases) might be something to look into though. It probably reads nicer than the generic FileMakerError.
Maybe something like this:
try:
fms.find(...)
except NoMatch:
...
We could subclass FileMakerError and thus keep it backward-compatible for existing implementations.
Currently if FileMaker server returns an error an exception of type
FileMakerError
is raised. The same exception is used for all error types.The problem that I am finding is that I now have to parse a lengthy text string to determine what the error actually was. In many instances this wouldn't be an issues, since it's likely to be fatal to the program execution and I'd need to log the exception (for example) and then provide some generic error response.
There are however times when you want to catch a specific error and behave differently for those. Immediate use cases I'm dealing with are
Would it be possible to either raise alternative exceptions for these errors, or expose the error code in the current exception?
The text was updated successfully, but these errors were encountered: