Exceptions

Tyranid provides the following exceptions:

ExceptionUsageHTTP Code*Example Reporting
AppErrorUse for any sort of application-level exception that is unexpected.500Bugsnag
EventCancelErrorGenerally 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.
SecureErrorUse for any sort of security violations like access denied.403Security log
UserErrorUse 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)
* The HTTP codes can be overridden in the Tyr.config() call.

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.