Nostalgic Punchcard Missing

    layerr
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.2 • Public • Published

    Layerr

    Errors, with.. layers..

    A NodeJS and Web Error wrapping utility, based heavily on VError, but without all the extras and dependencies on Node core utilities. Written in Typescript, compiled to JavaScript and suitable for bundling in the browser.

    Installation

    Install by running: npm install layerr.

    Usage

    Use it as a regular error:

    const { Layerr } = require("layerr");
     
    throw new Layerr("Test error");

    Or use it to wrap errors:

    doSomething().catch(err => {
        throw new Layerr(err, "Failed doing something");
    });

    Layerr's can have info attached:

    const { Layerr } = require("layerr");
     
    function somethingElse() {
        throw new Layerr({
            info: {
                code: 123
            }
        }, "Problem");
    }
     
    somethingElse().catch((err: Layerr) => {
        const { code } = Layerr.info(err);
        // code === 123
    });

    Install

    npm i layerr

    DownloadsWeekly Downloads

    24,723

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    9.29 kB

    Total Files

    14

    Last publish

    Collaborators

    • perrymitchell