Skip to content

Commit ee6fc59

Browse files
committed
monkey patch react native default error handling without overwriting it
1 parent 67fbdc2 commit ee6fc59

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

plugins/react-native.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ function reactNativePlugin(Raven) {
6969
}
7070
});
7171

72-
ErrorUtils.setGlobalHandler(Raven.captureException.bind(Raven));
72+
var defaultHandler = (ErrorUtils.getGlobalHandler && ErrorUtils.getGlobalHandler())
73+
|| ErrorUtils._globalHandler;
74+
ErrorUtils.setGlobalHandler(function(...args){
75+
defaultHandler(...args);
76+
Raven.captureException(...args);
77+
});
7378
}
7479

7580
module.exports = reactNativePlugin;

0 commit comments

Comments
 (0)