File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,25 +29,26 @@ export function determineFailureType(
2929 if ( err instanceof RequestError ) {
3030 const status = err . status ;
3131
32- if ( status === 401 ) {
33- return Errors . BAD_CREDENTIALS ;
34- }
35-
36- if ( status === 403 ) {
37- if ( message . includes ( "Missing the 'notifications' scope" ) ) {
38- return Errors . MISSING_SCOPES ;
39- }
40-
41- if (
42- message . includes ( 'API rate limit exceeded' ) ||
43- message . includes ( 'You have exceeded a secondary rate limit' )
44- ) {
45- return Errors . RATE_LIMITED ;
46- }
47- }
48-
49- if ( status === 500 ) {
50- return Errors . NETWORK ;
32+ switch ( status ) {
33+ case 401 :
34+ return Errors . BAD_CREDENTIALS ;
35+ case 403 :
36+ if ( message . includes ( "Missing the 'notifications' scope" ) ) {
37+ return Errors . MISSING_SCOPES ;
38+ }
39+
40+ if (
41+ message . includes ( 'API rate limit exceeded' ) ||
42+ message . includes ( 'You have exceeded a secondary rate limit' )
43+ ) {
44+ return Errors . RATE_LIMITED ;
45+ }
46+
47+ break ;
48+ case 500 :
49+ return Errors . NETWORK ;
50+ default :
51+ break ;
5152 }
5253 }
5354
You can’t perform that action at this time.
0 commit comments