Class BlipError

A BlipError is an error constructed with special considerations for HTTP clients.

A BlipError is safe for public APIs by default. It will not expose any sensitive information used directly.

See

inspection for remarks on using the error for inspection on server-side.

Hierarchy

  • BlipBase
    • BlipError

Constructors

  • Creates a new BlipError.

    Parameters

    • Optional message: string

      The error message.

    • Optional options: BlipOptions

      An object containing options for the error.

    Returns BlipError

Properties

_rootErr: undefined | Error

For internal use - use rootErr instead.

data: undefined | object

Metadata associated with the error.

See

BlipOptions

err: {
    message: string;
    statusCode: number;
}

Type declaration

  • message: string
  • statusCode: number

A special representation of BlipError that can be inspected by the console or used in custom logging solutions.

See

BlipInspectionError for more information and remarks.

message: string

A message associated with the error.

Default Value

''

Remarks

This is designed to be public-facing.

name: "BlipError" = 'BlipError'

Name of the Error - always 'BlipError'.

server: boolean

truthy when the error is a server error (status code >= 500), otherwise falsy.

stack: undefined | string

Stack trace associated with the Error.

Default Value

The default is the stack trace of rootErr if provided in BlipOptions, otherwise the stack trace of the BlipError which is automatically generated.

statusCode: number

HTTP Status code associated with the error.

See

BlipOptions

prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any)

Type declaration

stackTraceLimit: number

Accessors

  • get code(): number
  • Alias for statusCode.

    Alias

    statusCode

    Returns number

  • get originalStack(): undefined | string
  • Used to obtain the original stack when a rootErr was provided. (If a rootErr.stack is present, it will take the place of the BlipError stack).

    Returns undefined | string

  • get rootErr(): undefined | Error
  • Returns the root error that caused this error, if one was provided as BlipOptions' rootErr.

    Returns undefined | Error

  • get status(): number
  • Alias for statusCode.

    Alias

    statusCode

    Returns number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

Generated using TypeDoc