-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(replay): Add onError
callback + other small improvements to debugging
#13721
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
Conversation
…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`)
size-limit report 📦
|
if (DEBUG_BUILD && options._experiments && options._experiments.captureExceptions) { | ||
captureException(err); | ||
if (onError) { | ||
onError(err); |
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.
I wanted to propagate this up so that we're always using the same error capturing logic (e.g. replay.handleException
)
@@ -70,7 +70,7 @@ function makeReplayLogger(): ReplayLogger { | |||
}); | |||
|
|||
_logger.exception = (error: unknown, ...message: unknown[]) => { | |||
if (_logger.error) { | |||
if (message && _logger.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.
I think message will never be undefined, but an empty array? so this should probably be:
if (message && _logger.error) { | |
if (message.length && _logger.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.
Ah good catch, added some tests :)
This fixes the `onError` callback added in #13721 -- the option itself was not being propagated to the replay options.
This fixes the `onError` callback added in #13721 -- the option itself was not being propagated to the replay options.
onError
callback for replay SDK exceptionslogger.exception
ratelimit_backoff
client report when necessary (instead of genericsend_error
)