[ReactNative] differentiate fatal and soft exceptions

This commit is contained in:
Spencer Ahrens
2015-05-13 10:56:09 -07:00
committed by Christopher Chedeau
parent 484f63b1db
commit 81ad810186
6 changed files with 57 additions and 15 deletions

View File

@@ -22,14 +22,17 @@
ErrorUtils._globalHandler = fun;
},
reportError: function(error) {
Error._globalHandler && ErrorUtils._globalHandler(error);
ErrorUtils._globalHandler && ErrorUtils._globalHandler(error);
},
reportFatalError: function(error) {
ErrorUtils._globalHandler && ErrorUtils._globalHandler(error, true);
},
applyWithGuard: function(fun, context, args) {
try {
ErrorUtils._inGuard++;
return fun.apply(context, args);
} catch (e) {
ErrorUtils._globalHandler && ErrorUtils._globalHandler(e);
ErrorUtils.reportError(e);
} finally {
ErrorUtils._inGuard--;
}