File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -1301,14 +1301,26 @@ export const request = async (
1301
1301
return resp ;
1302
1302
}
1303
1303
1304
- if ( ! resp || ! resp . ok ) {
1305
- throw new Error ( 'API call failed or got non-OK response' ) ;
1304
+ if ( ! resp . ok ) {
1305
+ showWarningMessage (
1306
+ opts . errorMessage
1307
+ ? opts . errorMessage
1308
+ : `Error while communicating with backend: ${ resp . status } ${ resp . statusText } ${
1309
+ resp . status === 401 || resp . status === 403
1310
+ ? '; try logging in again, after manually saving any work.'
1311
+ : ''
1312
+ } `
1313
+ ) ;
1314
+ return null ;
1306
1315
}
1307
1316
1308
1317
return resp ;
1309
1318
} catch ( e ) {
1310
- store . dispatch ( actions . logOut ( ) ) ;
1311
- showWarningMessage ( opts . errorMessage ? opts . errorMessage : 'Please login again.' ) ;
1319
+ showWarningMessage (
1320
+ opts . errorMessage
1321
+ ? opts . errorMessage
1322
+ : 'Error while communicating with backend; check your network?'
1323
+ ) ;
1312
1324
1313
1325
return null ;
1314
1326
}
You can’t perform that action at this time.
0 commit comments