Skip to content

Commit d79b04c

Browse files
committed
Fix not sending event when native crash happens
1 parent 76e04f9 commit d79b04c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/Sentry.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export class Sentry {
3434
event => {
3535
Sentry._lastEvent = event;
3636
if (Sentry._eventSentSuccessfully) Sentry._eventSentSuccessfully(event);
37+
if (Sentry._internalEventSent) Sentry._internalEventSent();
3738
}
3839
);
3940
}
@@ -180,4 +181,8 @@ export class Sentry {
180181
static _captureEvent(event) {
181182
if (Sentry.isNativeClientAvailable()) Sentry._nativeClient.captureEvent(event);
182183
}
184+
185+
static _setInternalEventSent(callback) {
186+
Sentry._internalEventSent = callback;
187+
}
183188
}

lib/raven-plugin.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020
'use strict';
2121
import {NativeModules} from 'react-native';
22+
import {Sentry} from './Sentry';
2223

2324
function wrappedCallback(callback) {
2425
function dataCallback(data, original) {
@@ -139,7 +140,9 @@ function reactNativePlugin(Raven, options, internalDataCallback) {
139140
}
140141
Raven.captureException(error, captureOptions);
141142
// We always want to tunnel errors to the default handler
142-
defaultHandler(error, isFatal);
143+
Sentry._setInternalEventSent(() => {
144+
defaultHandler(error, isFatal);
145+
});
143146
});
144147
}
145148

0 commit comments

Comments
 (0)