-
Notifications
You must be signed in to change notification settings - Fork 309
api: Make a structured exception type for API errors, and use it #37
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
Comments
Some API errors are for conditions that we'll want to recognize as fatal to the current API connection: the user's auth credential was invalidated, the realm or user was deactivated (see zulip/zulip-mobile#4571), possibly more. (Maybe the invalid-event-queue error?) When working on this issue, I wonder if we need to think about those API errors differently than more mundane ones, like when you tried to send a message with a too-long topic. |
These are quite a lot like the ones we have in zulip-mobile, defined in `src/api/apiErrors.js` there. The main differences are: * Each exception has a `routeName` property, to identify what route was involved. This is information that can be quite helpful in debugging; and while it should typically be possible to work it out from looking at the stack, it's nicer to be explicit. * The exception types are named like FooException, whereas they're FooError in zulip-mobile. This is just to conform to Dart convention, where there's an Exception type and an Error type, and these are definitely Exception and not Error because they don't necessarily represent any bug in the program. Fixes: zulip#37
Like the
ApiError
and its base classRequestError
that we have in the RN app insrc/api/apiErrors.js
.The text was updated successfully, but these errors were encountered: