File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
debug_toolbar/static/debug_toolbar/js Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -321,16 +321,25 @@ const djdt = {
321321
322322 const origFetch = window . fetch ;
323323 window . fetch = function ( ...args ) {
324+ // Heads up! Before modifying this code, please be aware of the
325+ // possible unhandled errors that might arise from changing this.
326+ // For details, see
327+ // https://github.com/django-commons/django-debug-toolbar/pull/2100
324328 const promise = origFetch . apply ( this , args ) ;
325- promise . then ( ( response ) => {
329+ return promise . then ( ( response ) => {
326330 if ( response . headers . get ( "djdt-store-id" ) !== null ) {
327- handleAjaxResponse ( response . headers . get ( "djdt-store-id" ) ) ;
331+ try {
332+ handleAjaxResponse (
333+ response . headers . get ( "djdt-store-id" )
334+ ) ;
335+ } catch ( err ) {
336+ throw new Error (
337+ `"${ err . name } " occurred within django-debug-toolbar: ${ err . message } `
338+ ) ;
339+ }
328340 }
329- // Don't resolve the response via .json(). Instead
330- // continue to return it to allow the caller to consume as needed.
331341 return response ;
332342 } ) ;
333- return promise ;
334343 } ;
335344 } ,
336345 cookie : {
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ Pending
1515* Added a Makefile target (``make help ``) to get a quick overview
1616 of each target.
1717* Avoided reinitializing the staticfiles storage during instrumentation.
18+ * Fix for exception-unhandled "forked" Promise chain in rebound window.fetch
1819
19205.0.1 (2025-01-13)
2021------------------
You can’t perform that action at this time.
0 commit comments