diff --git a/lib/reply_error.js b/lib/reply_error.js index b72795f6..42a72baf 100644 --- a/lib/reply_error.js +++ b/lib/reply_error.js @@ -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;