Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/replay-internal/src/util/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ function makeReplayDebugLogger(): ReplayDebugLogger {
coreDebug.error(PREFIX, error);

if (_capture) {
captureException(error);
captureException(error, {
mechanism: {
handled: true,
type: 'auto.function.replay.debug',
},
});
} else if (_trace) {
// No need for a breadcrumb if `_capture` is enabled since it should be
// captured as an exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,12 @@ describe('Integration | sendReplayEvent', () => {
expect(spyHandleException).toHaveBeenCalledTimes(5);
const expectedError = new Error('Unable to send Replay - max retries exceeded');
(expectedError as any).cause = new Error('Something bad happened');
expect(spyHandleException).toHaveBeenLastCalledWith(expectedError);
expect(spyHandleException).toHaveBeenLastCalledWith(expectedError, {
mechanism: {
handled: true,
type: 'auto.function.replay.debug',
},
});

const spyHandleExceptionCall = spyHandleException.mock.calls;
expect(spyHandleExceptionCall[spyHandleExceptionCall.length - 1][0]?.cause.message).toEqual(
Expand Down
14 changes: 12 additions & 2 deletions packages/replay-internal/test/unit/util/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ describe('logger', () => {
const err = new Error('An error');
debug.exception(err, 'a message');
if (captureExceptions) {
expect(mockCaptureException).toHaveBeenCalledWith(err);
expect(mockCaptureException).toHaveBeenCalledWith(err, {
mechanism: {
handled: true,
type: 'auto.function.replay.debug',
},
});
}
expect(mockLogError).toHaveBeenCalledWith('[Replay] ', 'a message');
expect(mockLogError).toHaveBeenLastCalledWith('[Replay] ', err);
Expand All @@ -75,7 +80,12 @@ describe('logger', () => {
const err = new Error('An error');
debug.exception(err);
if (captureExceptions) {
expect(mockCaptureException).toHaveBeenCalledWith(err);
expect(mockCaptureException).toHaveBeenCalledWith(err, {
mechanism: {
handled: true,
type: 'auto.function.replay.debug',
},
});
expect(mockAddBreadcrumb).not.toHaveBeenCalled();
}
expect(mockLogError).toHaveBeenCalledTimes(1);
Expand Down