Skip to content

Commit a628aa7

Browse files
committed
fix: show error name the error stack for Node.js 8
1 parent 32a073a commit a628aa7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/reply_error.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
'use strict';
22

3-
module.exports = function ReplyError(message) {
4-
Error.captureStackTrace(this, this.constructor);
3+
var util = require('util');
4+
5+
function ReplyError(message) {
56
this.name = this.constructor.name;
6-
this.message = message;
7+
this.message = message || '';
8+
9+
if (Error.captureStackTrace) {
10+
Error.captureStackTrace(this, this.constructor);
11+
}
712
};
813

9-
require('util').inherits(module.exports, Error);
14+
util.inherits(ReplyError, Error);
15+
16+
module.exports = ReplyError;

0 commit comments

Comments
 (0)