Skip to content

Commit b98f32f

Browse files
committed
Merge pull request #492 from qbig/clean
monkey patch react native default error handling without overwriting it
2 parents 3696f5e + f23a0ca commit b98f32f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugins/react-native.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ function reactNativePlugin(Raven) {
7171
}
7272
});
7373

74-
ErrorUtils.setGlobalHandler(Raven.captureException.bind(Raven));
74+
var defaultHandler = (ErrorUtils.getGlobalHandler && ErrorUtils.getGlobalHandler())
75+
|| ErrorUtils._globalHandler;
76+
ErrorUtils.setGlobalHandler(function(){
77+
var error = arguments[0];
78+
defaultHandler.apply(this, arguments)
79+
Raven.captureException(error);
80+
});
7581
}
7682

7783
module.exports = reactNativePlugin;

0 commit comments

Comments
 (0)