Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New CATMAID error handling #142

Open
clbarnes opened this issue Sep 20, 2019 · 4 comments
Open

New CATMAID error handling #142

clbarnes opened this issue Sep 20, 2019 · 4 comments

Comments

@clbarnes
Copy link

clbarnes commented Sep 20, 2019

As of catmaid/CATMAID#1923 (not released at time of writing), the CATMAID server will return meaningful status codes on errors. The response content still contains the same JSON-serialised exception info, but the status code will no longer be 200. Generally, it will be 500, unless the server raised a ValueError (assumed to be the result of bad inputs, so it's 400), or the user had insufficient privileges (401).

This is a warning that you may need to update your fetch layer (although hopefully it's a welcome change!). Thanks @tomka for making the change.

Tracking issue here: catmaid/CATMAID#1921

@jefferis
Copy link
Collaborator

Thanks @clbarnes. What should I expect to get back? An appropriate error code with a body containing the detailed error message as json? Is there can example somewhere? AFAICS the rcatmaid code will continue to run fine, but may not print the detailed error message properly.

@clbarnes
Copy link
Author

The response body is exactly the same as it was before - a JSON object containing the error type, message, and traceback. All that's changing is the status code, which will now be 400, 401 or 500 as appropriate when the backend raises an exception. Presumably rcatmaid currently just ignores the status code as it's not informative, so I wouldn't expect this change to break anything; however, going forward you'll have the option of checking the status code to detect an error response, instead of having to parse the JSON and check its contents.

@clbarnes
Copy link
Author

Just for documentation purposes: catmaid/CATMAID@3b49a43 breaks rcatmaid compatibility; catmaid/CATMAID@1ac3845 fixes it again. Both are only in dev currently, the next release will include both.

The neurocean catmaidL1 instance we run has been updated with the fix (thanks to Michael Winding for catching this).

@jefferis
Copy link
Collaborator

Just a note that right now an http error code would trigger an immediate exception without parsing the catmaid error message. Some change will be required to continue to print informative error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants