0

I am using Trigger.io to with Catalyst for debugging. It appears that javascript exceptions thrown in the app do not bubble up to Trigger.io's Forge output messages.

I tried to alleviate this problem by using an on error handler like:

window.onerror = function(message, url, linenumber){
  forge.logging.debug("JavaScript error: " + message + " on line " + linenumber + " for " + url);
};

This will indeed capture exceptions and output messages. However the url, and linenumber are never reported in this case. Making this minimally helpful.

Hoping there is some documented solution this this that I may have overlooked or someone has a more reliable solution.

Update

here is a sample out put message:

[FORGE] 'JavaScript error: TypeError: \'undefined\' is not an object on line 0 for undefined:0

Using Jquery.

Update 2

Seems that this only happens for TypeErrors of undefined. Other errors seem to be reporting

[FORGE] 'JavaScript error: SyntaxError: Parse error on line 21222 for http://localhost.com:3000/assets/mobile_manifest.js:21222'
[FORGE] 'app starting !'
[FORGE] 'JavaScript error: TypeError: \'undefined\' is not an object on line 0 for undefined:0'
4

1 回答 1

0

你试过这样包装你的代码吗?

try {
  // Do something
} catch (err) {
  for (var e in err) {
    forge.logging.log(e + ":" + err[e]);
  }
}
于 2012-09-04T19:56:14.800 回答