Class: GeneralError
Class to handle errors.
Extends
Constructors
Constructor
new GeneralError(
source
,message
,properties?
,inner?
):GeneralError
Create a new instance of GeneralError.
Parameters
source
string
The source of the error.
message
string
The message as a code.
properties?
Any additional information for the error.
inner?
unknown
The inner error if we have wrapped another error.
Returns
GeneralError
Overrides
Properties
source?
optional
source:string
The source of the error.
Inherited from
properties?
optional
properties:object
Any additional information for the error.
Index Signature
[id
: string
]: unknown
Inherited from
inner?
optional
inner:IError
The inner error if there was one.
Inherited from
CLASS_NAME
readonly
static
CLASS_NAME:string
Runtime name for the class.
Methods
fromError()
static
fromError(err
):BaseError
Construct an error from an existing one.
Parameters
err
unknown
The existing error.
Returns
The new instance.
Inherited from
flatten()
static
flatten(err
):IError
[]
Flatten an error tree.
Parameters
err
unknown
The starting error.
Returns
IError
[]
The list of all internal errors.
Inherited from
expand()
static
expand(errors
):undefined
|IError
Expand an error tree.
Parameters
errors
The list of errors to expand.
undefined
| IError
[]
Returns
undefined
| IError
The first level error.
Inherited from
isErrorName()
static
isErrorName(error
,name
):error is BaseError
Test to see if the error has the specified error name.
Parameters
error
unknown
The error to test.
name
The name to check for.
string
| RegExp
Returns
error is BaseError
True if the error has the name.
Inherited from
isErrorMessage()
static
isErrorMessage(error
,message
):error is BaseError
Test to see if the error has the specified error message.
Parameters
error
unknown
The error to test.
message
The message to check for.
string
| RegExp
Returns
error is BaseError
True if the error has the name.
Inherited from
isErrorCode()
static
isErrorCode(error
,code
):boolean
Test to see if the error has the specified error code.
Parameters
error
unknown
The error to test.
code
The code to check for.
string
| RegExp
Returns
boolean
True if the error has the code.
Inherited from
someErrorName()
static
someErrorName(error
,name
):error is BaseError
Test to see if any of the errors or children have the given error name.
Parameters
error
unknown
The error to test.
name
The name to check for.
string
| RegExp
Returns
error is BaseError
True if the error has the name.
Inherited from
someErrorMessage()
static
someErrorMessage(error
,message
):error is BaseError
Test to see if any of the errors or children have the given error message.
Parameters
error
unknown
The error to test.
message
The message to check for.
string
| RegExp
Returns
error is BaseError
True if the error has the name.
Inherited from
someErrorClass()
static
someErrorClass(error
,cls
):error is BaseError
Test to see if any of the errors or children are from a specific class.
Parameters
error
unknown
The error to test.
cls
string
The class to check for.
Returns
error is BaseError
True if the error has the specific class.
Inherited from
someErrorCode()
static
someErrorCode(error
,code
):error is BaseError
Test to see if any of the errors or children have the given error code.
Parameters
error
unknown
The error to test.
code
The code to check for.
string
| RegExp
Returns
error is BaseError
True if the error has the name.
Inherited from
toJsonObject()
toJsonObject():
IError
Serialize the error to the error model.
Returns
The error model.