Better failure message when something is thrown that's not an error

Change from 'undefined : undefined' to '<thing that was thrown> thrown'

Pointed out by @charleshansen
This commit is contained in:
Sheel Choksi
2014-01-09 22:10:40 -08:00
parent aab4808410
commit 06a553503d
3 changed files with 21 additions and 6 deletions

View File

@@ -1,9 +1,13 @@
getJasmineRequireObj().ExceptionFormatter = function() {
function ExceptionFormatter() {
this.message = function(error) {
var message = error.name +
': ' +
error.message;
var message = '';
if (error.name && error.message) {
message += error.name + ': ' + error.message;
} else {
message += error.toString() + ' thrown';
}
if (error.fileName || error.sourceURL) {
message += " in " + (error.fileName || error.sourceURL);