[TIMOB-1057] iOS: Exceptions failing in event listeners
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Cannot Reproduce |
| Resolution Date | 2012-07-25T12:43:24.000+0000 |
| Affected Version/s | Release 1.5.0 |
| Fix Version/s | n/a |
| Components | iOS |
| Labels | n/a |
| Reporter | ctredway |
| Assignee | Neeraj Gupta |
| Created | 2011-04-15T02:42:45.000+0000 |
| Updated | 2012-07-26T22:25:12.000+0000 |
Description
a customer has reported that if there is a coding issue (i.e. missing var) in an event listener, that error fails to be registered in Developer. Following code shows this behavior.
var i=0;
i.missingMethod();
appropriately logs the exception but
btn.addEventListener('click', function() {
var i=0;
i.missingMethod();
});
does not.
This is a threading issue, certainly. We don't catch and report exceptions that occur on some threads.
I hit this issue so often that I don't call addEventListener() directly anymore, and instead use:
That's a great idea Damien; I'm embarrassed I never even thought of doing that. Keep forgetting how flexible Javascript is. Thanks! That'll be a great duct-tape bandage until they fix this.
Is there any way to do a stack trace with a try and catch?
Cannot reproduce described issue in SDK 2.2.0.f9e938d with iPhone Sim 5.1.
This logs information in the console indicating an exception has occurred.var i=0; i.missingMethod(); appropriately logs the exception but btn.addEventListener('click', function() { var i=0; i.missingMethod(); });