Class FuseError

A structured error object.

Hierarchy

  • Error
    • FuseError

Implements

Constructors

  • Parameters

    • domain: string

      The error domain, usually represents a library, class, or plugin.

    • message: string

      The error message

    • Optionalcause: TFuseErrorCause

      The underlying cause of the error. May be null.

    • Optionalcode: number

      An error code. May be null.

    Returns FuseError

Properties

message: string
name: string
stack?: string
prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any)

Optional override for formatting stack traces

stackTraceLimit: number

Methods

  • Returns TFuseErrorCause

    The underlying cause of the error, if known. May be null.

  • Returns string

    The error domain, usually representing a library, class, or plugin.

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void

  • Wraps the given object into a FuseError object. Accepts several different formats, which influences the behaviour of this method.

    If the input is a string, a FuseError object is created with the string as the error message of an unknown domain.

    If the input is a FuseError, then this method does nothing but passes through the FuseError. The returned FuseError is the input FuseError, a copy is not made.

    If the input is an Error, then a FuseError is created using the name as the domain, and it's message as the error message. The error object is also used as the FuseError's cause parameter.

    If the input is of the shape of IFuseErrorSerialized, then the object is deserialized into a FuseError instance.

    If any other type of object is given, an console error message will be printed and a "FuseError" domain error will be returned stating the error is not wrappable.

    Parameters

    • error: unknown

      A value that can represent an error

    Returns FuseError

    A FuseError instance