豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 8228fbf

Browse files
authored
chore: remove unused 'Error' from ConsoleFormatter (#895)
We no longer collect `pageerror` events so we don't need support for `Error` formatting.
1 parent f12651d commit 8228fbf

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/McpResponse.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,6 @@ export class McpResponse implements Response {
297297
);
298298
}
299299
detailedConsoleMessage = formatter;
300-
} else {
301-
detailedConsoleMessage = await ConsoleFormatter.from(message as Error, {
302-
id: consoleMessageStableId,
303-
});
304300
}
305301
}
306302

@@ -351,9 +347,7 @@ export class McpResponse implements Response {
351347
}
352348
return formatter;
353349
}
354-
return await ConsoleFormatter.from(item as Error, {
355-
id: consoleMessageStableId,
356-
});
350+
return null;
357351
},
358352
),
359353
)

src/formatters/ConsoleFormatter.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ export interface ConsoleFormatterOptions {
2121
}
2222

2323
export class ConsoleFormatter {
24-
#msg: ConsoleMessage | Error | SymbolizedError;
24+
#msg: ConsoleMessage | SymbolizedError;
2525
#resolvedArgs: unknown[] = [];
2626
#resolvedStackTrace?: DevTools.DevTools.StackTrace.StackTrace.StackTrace;
2727
#id?: number;
2828

2929
private constructor(
30-
msg: ConsoleMessage | Error | SymbolizedError,
30+
msg: ConsoleMessage | SymbolizedError,
3131
options?: ConsoleFormatterOptions,
3232
) {
3333
this.#msg = msg;
@@ -36,7 +36,7 @@ export class ConsoleFormatter {
3636
}
3737

3838
static async from(
39-
msg: ConsoleMessage | Error | UncaughtError,
39+
msg: ConsoleMessage | UncaughtError,
4040
options?: ConsoleFormatterOptions,
4141
): Promise<ConsoleFormatter> {
4242
if (msg instanceof UncaughtError) {
@@ -60,17 +60,13 @@ export class ConsoleFormatter {
6060
}
6161

6262
#isConsoleMessage(
63-
msg: ConsoleMessage | Error | SymbolizedError,
63+
msg: ConsoleMessage | SymbolizedError,
6464
): msg is ConsoleMessage {
6565
// No `instanceof` as tests mock `ConsoleMessage`.
6666
return 'args' in msg && typeof msg.args === 'function';
6767
}
6868

6969
async #loadDetailedData(devTools?: TargetUniverse): Promise<void> {
70-
if (this.#msg instanceof Error) {
71-
return;
72-
}
73-
7470
if (this.#isConsoleMessage(this.#msg)) {
7571
this.#resolvedArgs = await Promise.all(
7672
this.#msg.args().map(async (arg, i) => {

0 commit comments

Comments
 (0)