-
-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Bugfix async start / Clone Object before send over bridge #358
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does solve the issue where sentry crashes the app, but it doesn't do anything to tell us that the app is misconfigured. We probably won't know for a few days of no errors. Thank you for addressing so quickly.
@@ -91,7 +90,7 @@ public String getName() { | |||
} | |||
|
|||
@ReactMethod | |||
public void startWithDsnString(String dsnString, final ReadableMap options, Callback successCallback, Callback errorCallback) { | |||
public void startWithDsnString(String dsnString, final ReadableMap options, Promise promise) { | |||
if (sentryClient != null) { | |||
logger.info(String.format("Already started, use existing client '%s'", dsnString)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HazAT the promise should get rejected her or it will go unanswered. Perhaps that is the objective?
Sentry._ravenClient.install(); | ||
}) | ||
.catch(error => { | ||
throw error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is uncatchable here. We repro'd by throwing in the then
case like so.
try {
// install will throw if we test by putting a throw in the `then` callback.
// But since it happens in the future (asynchronously) we cannot catch it.
Sentry.config("legit_dsn_url").install();
} catch (e) {
console.error(e); // I will never be called.
}
Perhaps, if config()
was NOT chainable (by not returning Sentry) and it did its setup (and potential error throwing) in a synchronous manner we could catch and know when we have misconfigured the client. Or perhaps, you could pass along an event we could listen for to log when it has been misconfigured.
I definitely understand the design to not have await
apart of the Sentry API. Sentry, of course, shouldn't force the app to stop until sentry starts.
@@ -77,36 +71,40 @@ export class NativeClient { | |||
} | |||
}); | |||
} | |||
RNSentry.setLogLevel(options.logLevel); | |||
RNSentry.setLogLevel(this.options.logLevel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! We missed this.
This makes the start call async more info here:
#355
I've changed it so it works for iOS and Android.
Fixes #347