MCPcopy Index your code
hub / github.com/angular/angular / buildZoneAwareStackFrames

Function buildZoneAwareStackFrames

packages/zone.js/lib/common/error-rewrite.ts:67–113  ·  view source on GitHub ↗
(
      originalStack: string,
      zoneFrame: _ZoneFrame | ZoneFrameName | null,
      isZoneFrame = true,
    )

Source from the content-addressed store, hash-verified

65 }
66
67 function buildZoneAwareStackFrames(
68 originalStack: string,
69 zoneFrame: _ZoneFrame | ZoneFrameName | null,
70 isZoneFrame = true,
71 ) {
72 let frames: string[] = originalStack.split('\n');
73 let i = 0;
74 // Find the first frame
75 while (
76 !(
77 frames[i] === zoneAwareFrame1 ||
78 frames[i] === zoneAwareFrame2 ||
79 frames[i] === zoneAwareFrame1WithoutNew ||
80 frames[i] === zoneAwareFrame2WithoutNew ||
81 frames[i] === zoneAwareFrame3WithoutNew
82 ) &&
83 i < frames.length
84 ) {
85 i++;
86 }
87 for (; i < frames.length && zoneFrame; i++) {
88 let frame = frames[i];
89 if (frame.trim()) {
90 switch (zoneJsInternalStackFrames[frame]) {
91 case FrameType.zoneJsInternal:
92 frames.splice(i, 1);
93 i--;
94 break;
95 case FrameType.transition:
96 if (zoneFrame.parent) {
97 // This is the special frame where zone changed. Print and process it accordingly
98 zoneFrame = zoneFrame.parent;
99 } else {
100 zoneFrame = null;
101 }
102 frames.splice(i, 1);
103 i--;
104 break;
105 default:
106 frames[i] += isZoneFrame
107 ? ` [${(zoneFrame as _ZoneFrame).zone.name}]`
108 : ` [${(zoneFrame as ZoneFrameName).zoneName}]`;
109 }
110 }
111 }
112 return frames.join('\n');
113 }
114 /**
115 * This is ZoneAwareError which processes the stack frame and cleans up extra frames as well as
116 * adds zone information to it.

Callers 2

ZoneAwareErrorFunction · 0.85
patchErrorFunction · 0.85

Calls 1

joinMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…