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

Catch exceptions when accessing FullStory API methods #58

Merged
merged 6 commits into from
Jan 6, 2022

Conversation

greg-wb-ap
Copy link
Contributor

@greg-wb-ap greg-wb-ap commented Sep 30, 2021

Catch exceptions when accessing FS API methods, as otherwise the actual error that occurred gets swallowed by the FS exception.

Also upgraded some dependencies (rollup being the main one).

Catch exceptions when accessing FS API methods.
@souredoutlook
Copy link
Member

Pinging @scefali, contributor is looking to get a PR reviewed.

# Conflicts:
#	package.json
#	src/SentryFullStory.ts
@greg-wb-ap greg-wb-ap changed the title Upgrade dependencies & sentry peer version. Catch exceptions when accessing FullStory API methods Oct 28, 2021
@greg-wb-ap
Copy link
Contributor Author

Any action required to get this merged?

@leeandher leeandher self-assigned this Dec 9, 2021
@leeandher
Copy link
Member

@greg-wb-ap I see that you upgraded/edited some of the dependencies. We generally try to keep those to their own PRs, so would you mind revising this? Just functionality changes would make it an easier review/approval 😄

@greg-wb-ap
Copy link
Contributor Author

@leeandher I have removed the dependency changes from this PR. Thanks.

Copy link
Member

@leeandher leeandher left a comment

Choose a reason for hiding this comment

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

Looks good, just a few follow up questions @greg-wb-ap. Sorry for the delays!

Comment on lines 65 to 68
if (e instanceof Error) {
return `Unable to get url: ${e.message}`
}
return 'Unable to get url'
Copy link
Member

Choose a reason for hiding this comment

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

Is this check necessary? e.message should always exist right, since the param e in the catch block is always an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is you can throw anything in Javascript (it's just discouraged to not throw Error).

Copy link
Member

Choose a reason for hiding this comment

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

That's interesting, good catch! I think we're safe to assume it'll be an Error though so we can just return with the error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typescript complains if I try to access message without performing a typecheck - I have simplified this code a little though.

Comment on lines +86 to +88
} catch (e) {
console.debug('Unable to report sentry error details to FullStory')
}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason this is console.debug vs console.error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tend to only use console.error for things that result in user facing issues & this isn't a particularly informative message.
Happy to consider changes here if you have a suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

No suggestion, just curious for the reasoning, looks fine to me.

Copy link
Member

@leeandher leeandher left a comment

Choose a reason for hiding this comment

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

I think just revise the catch statement and it'll be set, thanks for the quick responses!

Comment on lines 65 to 68
if (e instanceof Error) {
return `Unable to get url: ${e.message}`
}
return 'Unable to get url'
Copy link
Member

Choose a reason for hiding this comment

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

That's interesting, good catch! I think we're safe to assume it'll be an Error though so we can just return with the error message.

Comment on lines +86 to +88
} catch (e) {
console.debug('Unable to report sentry error details to FullStory')
}
Copy link
Member

Choose a reason for hiding this comment

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

No suggestion, just curious for the reasoning, looks fine to me.

@leeandher leeandher merged commit 50a9056 into getsentry:master Jan 6, 2022
@leeandher
Copy link
Member

Sorry for the long review process, thanks for being patient! We'll batch this patch with another open PR for release once we get that reviewed.

leeandher added a commit that referenced this pull request Jan 21, 2022
With the new open source contributions merged, we are ready to release a new version with those changes.
 - Custom client option change: #60 
 - Exception catching on client methods: #58
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