Skip to content

Commit 72cae5c

Browse files
committed
chore: update error handling
1 parent 7232bc6 commit 72cae5c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

controlplane/src/core/services/Keycloak.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,10 @@ export default class Keycloak {
571571
// Cast the data to the expected type
572572
return data as ParsedOpenIdConfiguration;
573573
} catch (e: unknown) {
574-
if (isAxiosError(e)) {
574+
if (isCancel(e)) {
575+
// The user canceled the request
576+
throw new PublicError(EnumStatusCode.ERR, 'Request cancelled by user');
577+
} else if (isAxiosError(e)) {
575578
let message: string;
576579
switch (e.code) {
577580
case 'ECONNABORTED': {
@@ -586,9 +589,6 @@ export default class Keycloak {
586589
}
587590

588591
throw new PublicError(EnumStatusCode.ERR, message);
589-
} else if (isCancel(e)) {
590-
// The user canceled the request
591-
throw new PublicError(EnumStatusCode.ERR, 'Request cancelled by user');
592592
}
593593

594594
throw e;

0 commit comments

Comments
 (0)