An error that can be used to capture details for reporting to Sentry.

The error kind will be a tag on the reported Sentry event.

KindSentryError

Hierarchy (View Summary)

Constructors

  • Creates an instance of KindSentryError.

    Parameters

    • message: string

      The error message.

    • Optionalkind: string = Errors.Unknown

      The kind of error. This will be combined with prefix to form the name of the error, i.e. PrefixSentryKindError. Defaults to Errors.Unknown.

    • Optionaloptions: Options = ...

      Options for constructing the error.

      • cause

        The error that caused this error.

      • metadata

        The metadata to attach to the error.

      • prefix

        A prefix to prepend the name of the error.

      • name

        The name of the error.

      • stripStackFrames

        The number of stack frames to remove from the error's stack. This can be used to ensure that the top call of the stack references the point at which an error is thrown which can be useful when helper functions are used to build the error being thrown.

      • minimumFrameCount

        The minimum number of stack frames to try and retain. This can be used to prevent stripping all stack frames from the error's stack.

      • compositeStack

        Should we build a composite stack from the causal error chain or not?

    Returns KindSentryError

    KindSentryError

Properties

cause: undefined | null | Error
kind: string
message: string
metadata: undefined | null | Readonly<Metadata>
name: string
originalMessage: string
originalStack: string
stack?: string
prepareStackTrace?: (err: Error, stackTraces: CallSite[]) => any

Optional override for formatting stack traces

stackTraceLimit: number

Accessors

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void