class AppException abstract

extends Error

Custom error type that contains properties for a code and localizable (I18n) message.

To extend, use the static AppException.type() method, the base class cannot be instantiated.

Note: The instanceof operator cannot be used with typed errors; compare the code property of an error instance to the static code property (or a known value) of an AppException class, e.g. if (err.code === MyAppException.code) ....


(..._data: any[]): AppException

.type() static

(code: string, message: string): { new (data?: string | number): AppException; code: string; }

Create an AppException class that sets given code and message when instantiated. Given message is formatted using strf when an error object is created, with constructor parameters passed through as values.

.code static


Known error code for all instances of this error; should be checked instead of using the instanceof operator.