JsonObjectError is constructed with a JSON object, and will JSON.stringify correctly, but it extends Error so will also carry a stack trace.

Index

Constructors

Methods

Constructors

constructor

  • Constructs an instance of Error which will JSON.stringify correctly.

    Parameters

    • obj: object

      A JSON object, the properties of which will become the properties of the constructed Error. It is recommended to include a property "message".

    Returns JsonObjectError

Methods

Static assign

  • assign(error: Error, obj: object): Error
  • Assigns the properties of a JSON object to an existing Error, and ensures that the "message" property is enumerable.

    Parameters

    • error: Error

      An Error

    • obj: object

      A JSON object, the properties of which will become properties of the Error.

    Returns Error

    the passed-in Error

Generated using TypeDoc