File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
packages/next/src/client/components/react-dev-overlay/internal/helpers Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -76,10 +76,27 @@ export async function getOriginalStackFrames(
76
76
isEdgeServer : type === 'edge-server' ,
77
77
isAppDirectory : isAppDir ,
78
78
}
79
+
79
80
const res = await fetch ( '/__nextjs_original-stack-frames' , {
80
81
method : 'POST' ,
81
82
body : JSON . stringify ( req ) ,
82
83
} )
84
+
85
+ // When fails to fetch the original stack frames, we reject here to be
86
+ // caught at `_getOriginalStackFrame()` and return the stack frames so
87
+ // that the error overlay can render.
88
+ if ( ! res . ok || res . status === 204 ) {
89
+ const reason = await res . text ( )
90
+ return Promise . all (
91
+ frames . map ( ( frame ) =>
92
+ getOriginalStackFrame ( frame , {
93
+ status : 'rejected' ,
94
+ reason : `Failed to fetch the original stack frames: ${ reason } ` ,
95
+ } )
96
+ )
97
+ )
98
+ }
99
+
83
100
const data = await res . json ( )
84
101
return Promise . all (
85
102
frames . map ( ( frame , index ) => getOriginalStackFrame ( frame , data [ index ] ) )
You can’t perform that action at this time.
0 commit comments