Skip to content

Instantly share code, notes, and snippets.

@barmatz
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save barmatz/207e583566e29899c243 to your computer and use it in GitHub Desktop.

Select an option

Save barmatz/207e583566e29899c243 to your computer and use it in GitHub Desktop.
NoseJS custom error
'use strict';
var inherits = require('util').inherits;
function CustomError(message) {
Error.captureStackTrace(this, CustomError);
this.message = message;
}
inherits(CustomError, Error);
Object.defineProperties(CustomError.prototype, {
name: {
get: function () {
return 'ECUSTOM';
}
}
});
module.exports = CustomError;
@kbambz
Copy link

kbambz commented Oct 30, 2014

function CustomError(e, extra) {
  Error.call(this);
  Error.captureStackTrace(this, CustomError);
  this.id = e.id;
  this.name = 'CustomError';
  this.message = e.message
}

require('util').inherits(CustomError, Error);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment