• Version 4.5.0
  • Published
  • 52.3 kB
  • No dependencies
  • MIT license


npm i errlop
yarn add errlop
pnpm add errlop


An extended Error class that envelops a parent error, such that the stack trace contains the causation



class Errlop

class Errlop extends Error {}


    constructor(input: PotentialError, parent?: Errlop | Error);
    • Create an instance of an error, using a message, as well as an optional parent. If the parent is provided, then the fullStack property will include its stack too

    property ancestors

    ancestors: (Errlop | Error)[];
    • An array of all the ancestors. From parent, to grand parent, and so on.

    property exitCode

    exitCode?: string | number;
    • A numeric code to use for the exit status if desired by the consumer. It cycles through [input, this, ...ancestors] until it finds the first [exitCode, errno, code] that is valid.

    property klass

    klass: typeof Errlop;
    • Duck typing as node 4 and intanceof does not work for error extensions

    property orphanStack

    orphanStack: string;
    • The stack for our instance alone, without any parents. If the input contained a stack, then use that.

    property parent

    parent?: Errlop | Error;
    • The parent error if it was provided. If a parent was provided, then use that, otherwise use the input's parent, if it exists.

    property stack

    stack: string;
    • The stack which now contains the accumalated stacks of its ancestors. This is used instead of an alias like fullStack or the like, to ensure existing code that uses err.stack doesn't need to be changed to remain functional.

    method create

    static create: (input: PotentialError, parent?: Errlop | Error | null) => Errlop;
    • Syntatic sugar for Errlop class creation. Enables Errlop.create(...args) to achieve new Errlop(...args)

    method ensure

    static ensure: (value: any) => Errlop;
    • Ensure that the value is an Errlop instance

    method isErrlop

    static isErrlop: (value: any) => boolean;
    • Check whether or not the value is an Errlop instance

    Package Files (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (17)

    Peer Dependencies (0)

    No peer dependencies.


    To add a badge like this badgeto your package's README, use the codes available below.

    You may also use to create a custom badge linking to

    • Markdown
    • HTML
      <a href=""><img src="" alt=""></a>