src: don't print garbage errors
authorcjihrig <cjihrig@gmail.com>
Wed, 2 Dec 2015 01:34:45 +0000 (20:34 -0500)
committerMyles Borins <mborins@us.ibm.com>
Tue, 19 Jan 2016 19:52:17 +0000 (11:52 -0800)
commitc96eca164fb1697d44f546d8bb87b56cb618b362
treea4d7db0cba11e2480809ebf9dda797a20f2502bf
parentc9100d78f35dda6edb1b8d25a6d63bd9092c5b6e
src: don't print garbage errors

If JS throws an object whose toString() method throws, then Node
attempts to print an empty message, but actually prints garbage.
This commit checks for this case, and prints a message instead.

Fixes: https://github.com/nodejs/node/issues/4079
PR-URL: https://github.com/nodejs/node/pull/4112
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
src/node.cc
test/fixtures/throws_error7.js [new file with mode: 0644]
test/parallel/test-error-reporting.js