cloudchen / grunt-template-jasmine-requirejs

RequireJS template for grunt-contrib-jasmine task
111 stars 97 forks source link

Some errors are not caught correctly #68

Closed joseph-jja closed 9 years ago

joseph-jja commented 10 years ago

It seems that the template only catches require errors, but we have seen errors that are not from require. Like there is the require.onerror, there should be a window.onerror. Right now I have done something like the below to trap those other errors and get more information.

window.onerror = function(errorMsg, url, lineNumber) { var message = "ERROR in script: "; if ( errorMsg ) { message = message + errorMsg; if ( url ) { message = message + " in " + url; } if ( lineNumber ) { message = message + " at " + lineNumber; } throw message; } throw "Something bad happened, but I can't tell you what, cause I don't know :("; }

cloudchen commented 10 years ago

You want catch regular javascript error to terminal output?

joseph-jja commented 10 years ago

I want those errors to break a build. Right now a build passes on mac and linux but may fail on windows, or fail sometimes. In some cases it may just be an error.