swerrs

0.0.11 • Public • Published

Build Status

Stop Sw'erring, use swerrs

 
'use strict';
 
const SwError = require('swerrs');
 
const InvalidFileError = SwError.extend({
  name: 'InvalidFileError',
  onPush: function(v) {
    if (v.statusCode === 404) {
      this.fileMissing = true;
    }
  }
});
 
if (!process.env['XANAX']) {
  let err = new InvalidFileError('OMG!!!');
 
  // or supply it to the constructor... supports varargs and arrays
  err.push({ msg: `where's my file?!!`, statusCode: 404 });
 
  process.nextTick(() => {
    console.log(JSON.stringify(err, null, 2));
  });
}
 

Package Sidebar

Install

npm i swerrs

Weekly Downloads

2

Version

0.0.11

License

MIT

Last publish

Collaborators

  • austo