Skip to content

Commit c9c2985

Browse files
committed
move log statement to calling functions
1 parent c62a72f commit c9c2985

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/core/src/baseclient.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import {
3030
import { Backend, BackendClass } from './basebackend';
3131
import { IntegrationIndex, setupIntegrations } from './integration';
3232

33+
const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured.";
34+
3335
/**
3436
* Base implementation for all JavaScript SDK clients.
3537
*
@@ -104,6 +106,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
104106
public captureException(exception: any, hint?: EventHint, scope?: Scope): string | undefined {
105107
// ensure we haven't captured this very object before
106108
if (checkOrSetAlreadyCaught(exception)) {
109+
logger.log(ALREADY_SEEN_ERROR);
107110
return;
108111
}
109112

@@ -148,6 +151,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
148151
public captureEvent(event: Event, hint?: EventHint, scope?: Scope): string | undefined {
149152
// ensure we haven't captured this very object before
150153
if (hint?.originalException && checkOrSetAlreadyCaught(hint.originalException)) {
154+
logger.log(ALREADY_SEEN_ERROR);
151155
return;
152156
}
153157

packages/utils/src/misc.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { Event, Mechanism, StackFrame } from '@sentry/types';
33

44
import { getGlobalObject } from './global';
5-
import { logger } from './logger';
65
import { snipLine } from './string';
76

87
/**
@@ -260,7 +259,6 @@ export function stripUrlQueryAndFragment(urlPath: string): string {
260259
export function checkOrSetAlreadyCaught(exception: unknown): boolean {
261260
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
262261
if ((exception as any)?.__sentry_captured__) {
263-
logger.log("Not capturing exception because it's already been captured.");
264262
return true;
265263
}
266264

0 commit comments

Comments
 (0)