File tree Expand file tree Collapse file tree 1 file changed +11
-15
lines changed
debug_toolbar/static/debug_toolbar/js Expand file tree Collapse file tree 1 file changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -72,24 +72,20 @@ const $$ = {
7272
7373async function ajax ( url , init ) {
7474 try {
75- const response = await fetch (
76- url ,
77- Object . assign ( { credentials : "same-origin" } , init )
78- ) ;
75+ const response = await fetch ( url , {
76+ credentials : "same-origin" ,
77+ ... init ,
78+ } ) ;
7979 if ( response . ok ) {
80- return response
81- . json ( )
82- . catch ( ( error ) =>
83- Promise . reject (
84- new Error (
85- `The response is a invalid Json object : ${ error } `
86- )
87- )
80+ try {
81+ return response . json ( ) ;
82+ } catch ( error ) {
83+ throw new Error (
84+ u `The response is a invalid Json object : ${ error } `
8885 ) ;
86+ }
8987 }
90- return Promise . reject (
91- new Error ( `${ response . status } : ${ response . statusText } ` )
92- ) ;
88+ throw new Error ( `${ response . status } : ${ response . statusText } ` ) ;
9389 } catch ( error ) {
9490 const win = document . getElementById ( "djDebugWindow" ) ;
9591 win . innerHTML = `<div class="djDebugPanelTitle"><h3>${ error . message } </h3><button type="button" class="djDebugClose">»</button></div>` ;
You can’t perform that action at this time.
0 commit comments