err-code
Create new error instances with a code and additional properties.
Installation
$ npm install err-code// or$ bower install err-code
The browser file is named index.umd.js which supports CommonJS, AMD and globals (errCode).
Why
I find myself doing this repeatedly:
var err = 'My message';errcode = 'SOMECODE';errdetail = 'Additional information about the error';throw err;
Usage
Simple usage.
var errcode = ; // fill error with message + codethrow ;// fill error with message + code + propsthrow ;// fill error with message + propsthrow ;
Tests
$ npm test
License
Released under the MIT License.