Skip to content

Commit

Permalink
fix: show error name the error stack for Node.js 8
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed May 31, 2017
1 parent 32a073a commit a628aa7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/reply_error.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
'use strict';

module.exports = function ReplyError(message) {
Error.captureStackTrace(this, this.constructor);
var util = require('util');

function ReplyError(message) {
this.name = this.constructor.name;
this.message = message;
this.message = message || '';

if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
};

require('util').inherits(module.exports, Error);
util.inherits(ReplyError, Error);

module.exports = ReplyError;

0 comments on commit a628aa7

Please sign in to comment.