mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 12:45:37 +08:00
[ReactNative] differentiate fatal and soft exceptions
This commit is contained in:
committed by
Christopher Chedeau
parent
484f63b1db
commit
81ad810186
@@ -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--;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user