Skip to content

Commit 9b92c6e

Browse files
committed
remove parameterization for console.assert
there are some cases where this breaks badly
1 parent 394b71b commit 9b92c6e

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

dev-packages/browser-integration-tests/suites/public-api/logger/integration/test.ts

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -107,32 +107,7 @@ sentryTest('should capture console object calls', async ({ getLocalTestUrl, page
107107
{
108108
severityText: 'error',
109109
body: { stringValue: 'Assertion failed: console.assert 123 false' },
110-
attributes: [
111-
{
112-
key: 'sentry.message.template',
113-
value: {
114-
stringValue: 'Assertion failed: %s %s %s',
115-
},
116-
},
117-
{
118-
key: 'sentry.message.param.0',
119-
value: {
120-
stringValue: 'console.assert',
121-
},
122-
},
123-
{
124-
key: 'sentry.message.param.1',
125-
value: {
126-
doubleValue: 123,
127-
},
128-
},
129-
{
130-
key: 'sentry.message.param.2',
131-
value: {
132-
boolValue: false,
133-
},
134-
},
135-
],
110+
attributes: [],
136111
timeUnixNano: expect.any(String),
137112
traceId: expect.any(String),
138113
severityNumber: 17,

packages/core/src/logs/console-integration.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getClient } from '../currentScopes';
22
import { DEBUG_BUILD } from '../debug-build';
33
import { defineIntegration } from '../integration';
4-
import type { ConsoleLevel, IntegrationFn, ParameterizedString } from '../types-hoist';
4+
import type { ConsoleLevel, IntegrationFn } from '../types-hoist';
55
import { CONSOLE_LEVELS, GLOBAL_OBJ, addConsoleInstrumentationHandler, logger, safeJoin } from '../utils-hoist';
66
import { _INTERNAL_captureLog } from './exports';
77

@@ -35,13 +35,9 @@ const _consoleLoggingIntegration = ((options: Partial<CaptureConsoleOptions> = {
3535

3636
if (level === 'assert') {
3737
if (!args[0]) {
38-
let message: ParameterizedString = 'Assertion failed';
3938
const followingArgs = args.slice(1);
40-
if (followingArgs.length > 0) {
41-
message = new String(`Assertion failed: ${formatConsoleArgs(followingArgs)}`) as ParameterizedString;
42-
message.__sentry_template_string__ = `Assertion failed: ${followingArgs.map(() => '%s').join(' ')}`;
43-
message.__sentry_template_values__ = followingArgs;
44-
}
39+
const message =
40+
followingArgs.length > 0 ? `Assertion failed: ${formatConsoleArgs(followingArgs)}` : 'Assertion failed';
4541
_INTERNAL_captureLog({ level: 'error', message });
4642
}
4743
return;

0 commit comments

Comments
 (0)