Skip to content
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

Merged
merged 3 commits into from
Feb 16, 2018

Conversation

HazAT
Copy link
Member

@HazAT HazAT commented Feb 16, 2018

This makes the start call async more info here:
#355
I've changed it so it works for iOS and Android.

Fixes #347

@HazAT HazAT self-assigned this Feb 16, 2018
@HazAT HazAT changed the title Bugfix async start Bugfix async start / Clone Object before send over bridge Feb 16, 2018
@HazAT HazAT changed the title Bugfix async start / Clone Object before send over bridge fix: Bugfix async start / Clone Object before send over bridge Feb 16, 2018
@HazAT HazAT requested a review from mitsuhiko February 16, 2018 10:07
@HazAT HazAT merged commit df69335 into master Feb 16, 2018
@HazAT HazAT deleted the bugfix/async-start branch February 16, 2018 10:19
Copy link
Contributor

@cworsley4 cworsley4 left a 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));
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! We missed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants