The 'ExtendError' class is a custom error class that provides extended error information. This class extends the underlying JavaScript 'Error' class to provide additional properties and features.

Constructors

Properties

Methods

Constructors

  • Creates an instance of the class 'ExtendError'.

    Parameters

    • msg: string

      Error message.

    • Optionalprop: Iprop | ExtendError

      (Optional) Previous 'ExtendError' object or property type error message.

    Returns ExtendError

    const error = new ExtendError('An error occurred', { key: 'value' });
    
  • Use the message code to create an instance of the class 'ExtendError'.

    Parameters

    • msgCode: RegExp

      Error message code.

    • Optionalprop: Iprop | ExtendError

      (Optional) Previous 'ExtendError' object or property type error message.

    • OptionalcodeValue: string[]

      (Optional) Conversion values of message code ($1, $2..).

    Returns ExtendError

    const error = new ExtendError(/ES010/, { key: 'value' }, ['404']);
    

Properties

message: string

Error message.

name: string

Error name.

prop: Iprop

Property type error message.

queue: string[]

Message queues that occurred previously.

stack?: string

Outputs an error message.

Returns this.message.

Methods

  • Outputs an error message.

    Returns string

    Returns 'this.message'.

    const error = new ExtendError('An error occurred');
    console.log(error.toString()); // 'An error occurred'