Skip to content

Commit

Permalink
fix(common): more detailed info about error
Browse files Browse the repository at this point in the history
  • Loading branch information
lusarz committed Feb 23, 2018
1 parent fca048b commit 424aacc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ var stringify = function stringify (obj, depth) {
return obj.outerHTML
} else if (isNode(obj)) {
return serialize(obj)
} else if (instanceOf(obj, 'Error')) {
return obj.toString() + '\n' + obj.stack
} else {
var constructor = 'Object'
if (obj.constructor && typeof obj.constructor === 'function') {
Expand Down
5 changes: 5 additions & 0 deletions test/client/stringify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ describe('stringify', function () {
assert.deepEqual(stringify(div).trim().toLowerCase(), '<div>some <span>text</span></div>')
})

it('should serialize error', function () {
var error = new TypeError('Error description')
assert(stringify(error).indexOf('Error description') > -1)
})

it('should serialize DOMParser objects', function () {
if (typeof DOMParser !== 'undefined') {
// Test only works in IE 9 and above
Expand Down

0 comments on commit 424aacc

Please sign in to comment.