Skip to content

Commit 64ac345

Browse files
committed
track stack trace symbolication failures
1 parent d95ac13 commit 64ac345

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

front_end/core/host/RNPerfMetrics.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,17 @@ class RNPerfMetrics {
259259
});
260260
}
261261

262+
stackTraceSymbolicationFailed(stackTrace: string, line: string, reason: string): void {
263+
this.sendEvent({
264+
eventName: 'StackTraceSymbolicationFailed',
265+
params: {
266+
stackTrace,
267+
line,
268+
reason,
269+
},
270+
});
271+
}
272+
262273
panelShown(_panelName: string, _isLaunching?: boolean): void {
263274
// no-op
264275
// We only care about the "main" and "drawer" panels for now via panelShownInLocation(…)
@@ -423,10 +434,19 @@ export type PanelClosedEvent = Readonly<{
423434
}>,
424435
}>;
425436

437+
export type StackTraceSymbolicationFailed = Readonly<{
438+
eventName: 'StackTraceSymbolicationFailed',
439+
params: Readonly<{
440+
stackTrace: string,
441+
line: string,
442+
reason: string,
443+
}>,
444+
}>;
445+
426446
export type ReactNativeChromeDevToolsEvent =
427447
EntrypointLoadingStartedEvent|EntrypointLoadingFinishedEvent|DebuggerReadyEvent|BrowserVisibilityChangeEvent|
428448
BrowserErrorEvent|RemoteDebuggingTerminatedEvent|DeveloperResourceLoadingStartedEvent|
429449
DeveloperResourceLoadingFinishedEvent|FuseboxSetClientMetadataStartedEvent|FuseboxSetClientMetadataFinishedEvent|
430-
MemoryPanelActionStartedEvent|MemoryPanelActionFinishedEvent|PanelShownEvent|PanelClosedEvent;
450+
MemoryPanelActionStartedEvent|MemoryPanelActionFinishedEvent|PanelShownEvent|PanelClosedEvent|StackTraceSymbolicationFailed;
431451

432452
export type DecoratedReactNativeChromeDevToolsEvent = CommonEventFields&ReactNativeChromeDevToolsEvent;

front_end/panels/console/ErrorStackParser.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as Common from '../../core/common/common.js';
66
import type * as Platform from '../../core/platform/platform.js';
77
import type * as SDK from '../../core/sdk/sdk.js';
88
import type * as Protocol from '../../generated/protocol.js';
9+
import * as Host from '../../core/host/host.js';
910

1011
export interface ParsedErrorFrame {
1112
line: string;
@@ -43,6 +44,7 @@ export function parseSourcePositionsFromErrorStack(
4344
const match = /^\s*at\s(async\s)?/.exec(line);
4445
if (!match) {
4546
if (linkInfos.length && linkInfos[linkInfos.length - 1].isCallFrame) {
47+
Host.rnPerfMetrics.stackTraceSymbolicationFailed(stack, line, '"at (url)" not found');
4648
return null;
4749
}
4850
linkInfos.push({line});
@@ -59,6 +61,7 @@ export function parseSourcePositionsFromErrorStack(
5961
do {
6062
left = line.indexOf(' (', left);
6163
if (left < 0) {
64+
Host.rnPerfMetrics.stackTraceSymbolicationFailed(stack, line, 'left "(" not found');
6265
return null;
6366
}
6467
left += 2;
@@ -68,6 +71,7 @@ export function parseSourcePositionsFromErrorStack(
6871
left += 8;
6972
right = line.lastIndexOf(', ', right) - 1;
7073
if (right < 0) {
74+
Host.rnPerfMetrics.stackTraceSymbolicationFailed(stack, line, 'right "(" not found');
7175
return null;
7276
}
7377
} while (true);
@@ -89,6 +93,7 @@ export function parseSourcePositionsFromErrorStack(
8993
url = parseOrScriptMatch(debuggerModel, Common.ParsedURL.ParsedURL.completeURL(baseURL, splitResult.url));
9094
}
9195
if (!url) {
96+
Host.rnPerfMetrics.stackTraceSymbolicationFailed(stack, line, 'url parsing failed');
9297
return null;
9398
}
9499

0 commit comments

Comments
 (0)