tests: jstest: generalize exception reporting - try harder to get a stack

(integrated from master branch change 9e43cdb by Todd Whiteman <toddw@activestate.com>)