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

feat(replay): Add onError callback + other small improvements to debugging #13721

Merged
merged 3 commits into from
Sep 19, 2024

Conversation

billyvg
Copy link
Member

@billyvg billyvg commented Sep 18, 2024

  • Adds an onError callback for replay SDK exceptions
  • Do not log empty messages when calling logger.exception
  • Send ratelimit_backoff client report when necessary (instead of generic send_error)

…bugging

* Adds an `onError` callback for replay SDK exceptions
* Do not log empty messages when calling `logger.exception`
* Send `ratelimit_backoff` client report when necessary (instead of generic `send_error`)
Copy link
Contributor

github-actions bot commented Sep 18, 2024

size-limit report 📦

Path Size % Change Change
@sentry/browser 22.52 KB - -
@sentry/browser - with treeshaking flags 21.3 KB - -
@sentry/browser (incl. Tracing) 34.8 KB - -
@sentry/browser (incl. Tracing, Replay) 71.3 KB +0.06% +41 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 61.75 KB +0.08% +49 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 75.64 KB +0.05% +34 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 88.43 KB +0.04% +36 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 90.28 KB +0.06% +47 B 🔺
@sentry/browser (incl. metrics) 26.83 KB - -
@sentry/browser (incl. Feedback) 39.66 KB - -
@sentry/browser (incl. sendFeedback) 27.19 KB - -
@sentry/browser (incl. FeedbackAsync) 31.96 KB - -
@sentry/react 25.28 KB - -
@sentry/react (incl. Tracing) 37.77 KB - -
@sentry/vue 26.72 KB - -
@sentry/vue (incl. Tracing) 36.67 KB - -
@sentry/svelte 22.66 KB - -
CDN Bundle 23.83 KB - -
CDN Bundle (incl. Tracing) 36.56 KB - -
CDN Bundle (incl. Tracing, Replay) 71.06 KB +0.07% +48 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 76.38 KB +0.07% +48 B 🔺
CDN Bundle - uncompressed 69.81 KB - -
CDN Bundle (incl. Tracing) - uncompressed 108.44 KB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 220.31 KB +0.05% +102 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 233.53 KB +0.05% +102 B 🔺
@sentry/nextjs (client) 37.53 KB - -
@sentry/sveltekit (client) 35.37 KB - -
@sentry/node 121.77 KB - -
@sentry/node - without tracing 93.41 KB - -
@sentry/aws-serverless 103.11 KB - -

View base workflow run

if (DEBUG_BUILD && options._experiments && options._experiments.captureExceptions) {
captureException(err);
if (onError) {
onError(err);
Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to propagate this up so that we're always using the same error capturing logic (e.g. replay.handleException)

@billyvg billyvg marked this pull request as ready for review September 18, 2024 19:55
@billyvg billyvg requested a review from a team as a code owner September 18, 2024 19:55
@@ -70,7 +70,7 @@ function makeReplayLogger(): ReplayLogger {
});

_logger.exception = (error: unknown, ...message: unknown[]) => {
if (_logger.error) {
if (message && _logger.error) {
Copy link
Member

Choose a reason for hiding this comment

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

I think message will never be undefined, but an empty array? so this should probably be:

Suggested change
if (message && _logger.error) {
if (message.length && _logger.error) {

🤔 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah good catch, added some tests :)

@billyvg billyvg merged commit cf0152a into develop Sep 19, 2024
130 checks passed
@billyvg billyvg deleted the feat-replay-add-callback-on-error branch September 19, 2024 16:30
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