AppError extends Error

This is an extension of the standard JavaScript Error object.

It should be used for system and application errors that were caused by internal failures of the application.

This is contrast to UserError which indicates an error caused by bad user input or user data.

Typically AppErrors will be logged to a log file or a bug-tracking service like Bugsnag while UserErrors will not be logged and will instead be presented to the end-user either as a pop-up or inline in forms.

See Exceptions for more information.

constructor

(opts: object | string)

If opts is a string, then it contains the technical description of the problem. The message will default to "Internal Application Error" (or whatever is defined in Tyr.config() under the exceptions entry.

If opts is an objec†, then:

{
  message: string;       // This message contains an end-user-facing error message that can be displayed in the UI.
  technical?: string;    // If present, this should contain additional technical information that would be relevant to a software developer.
  field?: Field;         // This indicates an error is directly related to a given field.
  lineNumber?: number;   // This indicates any line number that has to do with the error message.
  rowNumber?: number;    // This indicates any row number that has to do with the error message.
  columnNumber?: number; // This indicates any column number that has to do with the error message.
}

instance

columnNumber?: number

This indicates any column number that has to do with the error message.

field?: Field

This indicates an error is directly related to a given field.

lineNumber?: number

This indicates any line number that has to do with the error message.

message: string

This message contains an end-user-facing error message that can be displayed in the UI.

rowNumber?: number

This indicates any row number that has to do with the error message.

stack?: string

This contains the stack trace if available.

technical?: string

If present, this should contain additional technical information that would be relevant to a software developer.

toPlain(): object

This returns a "Plain old JavaScript object" representation of this exception that is suitable for stringifying to JSON.

toString(): string

This returns message.