@voiceflow/verror
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

circle ci Coverage Quality Gate Status

verror

Voiceflow error class

Install

npm i -S @voiceflow/verror

Use

const VError = require('@voiceflow/verror');

// Throws error which inheirits from Error and has a default http code of 500 INTERNAL_SERVER_ERROR
const throws = () => { throw new VError('boom'); };

// Throw with a different http code
// VError.HTTP_STATUS is just the 'http-status' package
const throwsWithHttpError = () => { throw new VError('boom', VError.HTTP_STATUS.BAD_REQUEST); };

// Throw with special data
const throwsWithData = () => { throw new VError('boom', undefined, {foo: 'bar'}); };

verror

Kind: global class

new verror(message, [code], [data])

Param Type Default Description
message string error message
[code] number 500 http error code
[data] any any extra data to attach to the error

/@voiceflow/verror/

    Package Sidebar

    Install

    npm i @voiceflow/verror

    Weekly Downloads

    409

    Version

    1.1.3

    License

    MIT

    Unpacked Size

    6.58 kB

    Total Files

    6

    Last publish

    Collaborators

    • cheatcod
    • ebra-vf
    • saargue
    • ganeshasapu
    • gillyb
    • ose-voiceflow
    • theprof
    • bhuvana.adur.kannan
    • abuyak
    • e_vandenberg
    • ninabondar
    • yoyotruly
    • matthewnaik
    • edison-vflow
    • shelone.grantwatson
    • zhilight
    • amandasteinhauer
    • pmvrmc
    • filipemerker
    • viniciusdacal
    • trs
    • matheuspoleza
    • denyslinkov
    • andrewlawrence
    • tylerhhan
    • effervescentia
    • josh_vf
    • voiceflow-gallagan
    • z4o4z
    • xavidop
    • vf-serviceaccount