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'
kevzettler
  • 4,783
  • 15
  • 58
  • 103

1 Answers1

0

Did you try wrapping your code like this?

try {
  // Do something
} catch (err) {
  for (var e in err) {
    forge.logging.log(e + ":" + err[e]);
  }
}
Kris Krause
  • 7,304
  • 2
  • 23
  • 26
  • I have all my app code wrapped in a `try/catch` like this but instead of logging directly to forge it throws the exception. It should then get caught by the `window.onerror`. I'll experiment with this and see if its any more verbose. – kevzettler Sep 04 '12 at 21:41
  • changing the try/catch to this suggestion produces the same output just broken into different lines per the `forge.logging` for loop. – kevzettler Sep 04 '12 at 22:07