Exceptions
Tyranid provides the following exceptions:
Exception | Usage | HTTP Code | Example Reporting |
---|---|---|---|
AppError | Use for any sort of application-level exception that is unexpected. | 500 | Bugsnag |
EventCancelError | Generally should not be used manually, sent when an event handler calls "preventDefault()". | Not rethrown | Not reported since this indicates that an event should not be propagated for non-error reasons. |
SecureError | Use for any sort of security violations like access denied. | 403 | Security log |
UserError | Use for any sort of user errors where the problem lies with bad input or data from the user. | 400 | Not logged, reported inline in the user interface (for example, below form fields, or as toast messages, depending on the context) |
Exceptions that have an HTTP Code defined indicate that the exception will be rethrown in the calling context. For example, if a call is made in the web browser to a server via a service, and the service throws a rethrowable exception, then the exception thrown on the server will be caught, serialized, sent along the HTTP, and then reified and rethrown on the client.
Exceptions thrown inside event handlers will also be rethrown in the calling context.