File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -335,10 +335,16 @@ define([
335
335
return new Promise ( function ( resolve , reject ) {
336
336
try {
337
337
fetch ( url ) . then ( function ( response ) {
338
- if ( response . ok ) {
338
+ if ( response . statusCode === 200 ) {
339
339
return response . json ( ) ;
340
+ } else if ( response . statusCode === 204 ) {
341
+ throw new Error ( 'No Contents' , response ) ;
342
+ } else if ( response . statusCode === 404 ) {
343
+ throw new Error ( 'Page Not Found' , response ) ;
344
+ } else if ( response . statusCode === 500 ) {
345
+ throw new Error ( 'Internal Server Error' , response ) ;
340
346
} else {
341
- throw new Error ( 'Error ' , response ) ;
347
+ throw new Error ( 'Unexpected Http Status Code ' , response ) ;
342
348
}
343
349
} ) . then ( function ( data ) {
344
350
resolve ( data . info . version ) ;
You can’t perform that action at this time.
0 commit comments