You need to define what you mean by "still reporting it to the browser".
The short answer might be that if you had some alternate logging system you could try doing something similar to this:
var apperrors;
function appLog(error){
apperrors = apperrors || [];
apperrors.push(error);
//maybe trigger an app error event?
}
function doSomeStuff() {
for (var i in arguments) {
try {
arguments[i].apply(this);
}
catch (e) {
appLog(e);
}
}
}
And then do something with your errors. You don't really describe what that something is though.
EDIT
#EDIT FollowingFollowing the comment below: if you catch the error you have three courses of action I can see:
- ignore it (That's bad)
- rethrow it and do something additional (i.e. because you want to notify the user more gracefully)
- or catch the error, and handle it in some other fashion that isn't as agressive
I you re-throw the error you're not gaining anything unless you do something 'additional'.