MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / ensureMetadataStacksAreParsed

Function ensureMetadataStacksAreParsed

packages/core/src/metadata.ts:42–68  ·  view source on GitHub ↗
(parser: StackParser)

Source from the content-addressed store, hash-verified

40}
41
42function ensureMetadataStacksAreParsed(parser: StackParser): void {
43 if (!GLOBAL_OBJ._sentryModuleMetadata) {
44 return;
45 }
46
47 for (const stack of Object.keys(GLOBAL_OBJ._sentryModuleMetadata)) {
48 const metadata = GLOBAL_OBJ._sentryModuleMetadata[stack];
49
50 if (parsedStacks.has(stack)) {
51 continue;
52 }
53
54 // Ensure this stack doesn't get parsed again
55 parsedStacks.add(stack);
56
57 const frames = parser(stack);
58
59 // Go through the frames starting from the top of the stack and find the first one with a filename
60 for (const frame of frames.reverse()) {
61 if (frame.filename) {
62 // Save the metadata for this filename
63 filenameMetadataMap.set(frame.filename, metadata);
64 break;
65 }
66 }
67 }
68}
69
70/**
71 * Retrieve metadata for a specific JavaScript file URL.

Callers 1

getMetadataForUrlFunction · 0.85

Calls 4

keysMethod · 0.65
hasMethod · 0.65
addMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected