Skip to content

Commit

Permalink
fix: Call toString on error (#479)
Browse files Browse the repository at this point in the history
Issue #478 attempted to break the error apart to perserve the stacktrace, but it
looks like it's failing to produce the error message at all (depedning on the
test framework/logging setup).

We're going to call `.toString` on the error to print the message. If the user
wants the stack trace, they will need to open the browser and place a breakpoint
on the error log.
  • Loading branch information
Robdel12 committed Mar 5, 2020
1 parent ffbebfd commit 175a3eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/percy-agent-client/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class DOM {
try {
dom = this.options.domTransformation(dom)
} catch (error) {
console.error('Could not transform the dom:')
console.error(error)
console.error('Could not transform the dom: ', error.toString())
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/percy-agent-client/dom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('DOM -', () => {
expect(consoleStub.called).to.equal(false)
// invoke the transform function again to try and remove a non-existent element
expect(dom.snapshotString()).to.contain('Hello DOM testing')
expect(consoleStub.calledTwice).to.equal(true)
expect(consoleStub.calledOnce).to.equal(true)
})
})

Expand Down

0 comments on commit 175a3eb

Please sign in to comment.