Skip to content

Commit d93e5ed

Browse files
committed
fixup eventual logging
1 parent 862a83b commit d93e5ed

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/core/src/baseclient.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,13 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
586586
if (__DEBUG_BUILD__) {
587587
// If something's gone wrong, log the error as a warning. If it's just us having used a `SentryError` for
588588
// control flow, log just the message (no stack) as a log-level log.
589-
const logLevel = (reason as SentryError).logLevel || 'warn';
590-
const logee = logLevel === 'log' ? (reason as SentryError).message : reason;
591-
logger[logLevel as 'log' | 'warn'](logee);
589+
if (reason instanceof SentryError) {
590+
// `SentryError`s are tagged as 'warn' by default, but can be marked as 'log' if they don't actually indicate
591+
// a problem
592+
logger[reason.logLevel as 'log' | 'warn'](reason.message);
593+
} else {
594+
logger.warn(reason);
595+
}
592596
}
593597
return undefined;
594598
},

0 commit comments

Comments
 (0)