Skip to content

Commit

Permalink
[fix v0.6] No error.stack for nextTick errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Oct 11, 2011
1 parent eac4362 commit fd44e08
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/assert/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ var inspect = require('../vows/console').inspect;

require('assert').AssertionError.prototype.toString = function () {
var that = this,
source;

if (this.stack) {
source = this.stack.match(/([a-zA-Z0-9._-]+\.js)(:\d+):\d+/);
}

function parse(str) {
return str.replace(/{actual}/g, inspect(that.actual)).
Expand All @@ -15,7 +19,7 @@ require('assert').AssertionError.prototype.toString = function () {

if (this.message) {
return stylize(parse(this.message), 'yellow') +
stylize(' // ' + source[1] + source[2], 'grey');
(source) ? stylize(' // ' + source[1] + source[2], 'grey') : '';
} else {
return stylize([
this.expected,
Expand Down

0 comments on commit fd44e08

Please sign in to comment.