Skip to content

Commit

Permalink
add __filename, always show construct name
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse committed Nov 6, 2014
1 parent 1c3a891 commit b841f81
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions index.js
Expand Up @@ -44,11 +44,9 @@ function Base() {
util.inherits(Base, EventEmitter);

Base.prototype.defaultErrorHandler = function (err) {
if (err.name === 'Error') {
err.name = this.constructor.name + 'Error';
}
console.error('\n[%s][pid: %s] %s: %s \nError Stack:\n %s',
Date(), process.pid, err.name, err.message, err.stack);
console.error('\n[%s][pid: %s][%s][%s] %s: %s \nError Stack:\n %s',
Date(), process.pid, this.constructor.name, __filename, err.name,
err.message, err.stack);

// try to show addition property on the error object
// e.g.: `err.data = {url: '/foo'};`
Expand Down

0 comments on commit b841f81

Please sign in to comment.