Skip to content

Commit

Permalink
Updates error code match to include 400
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed May 25, 2024
1 parent 94c1588 commit a32a285
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ export function AuditLogging(props: AuditLoggingProps) {
} catch (e) {
// TODO: switch to better error handling.
console.log(e);
if (e.response && e.response.status === 403) {
// requests with existing credentials but insufficient permissions result in 403, remote data-source requests with non-existing credentials result in 400
if (e.response && [400, 403].includes(e.response.status)) {
setAccessErrorFlag(true);
}
} finally {
Expand Down
3 changes: 2 additions & 1 deletion public/apps/configuration/panels/auth-view/auth-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export function AuthView(props: AppDependencies) {
setAccessErrorFlag(false);
} catch (e) {
console.log(e);
if (e.response && e.response.status === 403) {
// requests with existing credentials but insufficient permissions result in 403, remote data-source requests with non-existing credentials result in 400
if (e.response && [400, 403].includes(e.response.status)) {
setAccessErrorFlag(true);
}
setErrorFlag(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ export function PermissionList(props: AppDependencies) {
setAccessErrorFlag(false);
} catch (e) {
console.log(e);
if (e.response && e.response.status === 403) {
// requests with existing credentials but insufficient permissions result in 403, remote data-source requests with non-existing credentials result in 400
if (e.response && [400, 403].includes(e.response.status)) {
setAccessErrorFlag(true);
}
setErrorFlag(true);
Expand Down
3 changes: 2 additions & 1 deletion public/apps/configuration/panels/role-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ export function RoleList(props: AppDependencies) {
setAccessErrorFlag(false);
} catch (e) {
console.log(e);
if (e.response && e.response.status === 403) {
// requests with existing credentials but insufficient permissions result in 403, remote data-source requests with non-existing credentials result in 400
if (e.response && [400, 403].includes(e.response.status)) {
setAccessErrorFlag(true);
}
setErrorFlag(true);
Expand Down
3 changes: 2 additions & 1 deletion public/apps/configuration/panels/service-account-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export function ServiceAccountList(props: AppDependencies) {
setAccessErrorFlag(false);
} catch (e) {
console.log(e);
if (e.response && e.response.status === 403) {
// requests with existing credentials but insufficient permissions result in 403, remote data-source requests with non-existing credentials result in 400
if (e.response && [400, 403].includes(e.response.status)) {
setAccessErrorFlag(true);
}
setErrorFlag(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ export function ConfigureTab1(props: AppDependencies) {
} catch (e) {
// TODO: switch to better error display.
console.error(e);
if (e.response && e.response.status === 403) {
// requests with existing credentials but insufficient permissions result in 403, remote data-source requests with non-existing credentials result in 400
if (e.response && [400, 403].includes(e.response.status)) {
setAccessErrorFlag(true);
}
} finally {
Expand Down
3 changes: 2 additions & 1 deletion public/apps/configuration/panels/tenant-list/manage_tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ export function ManageTab(props: AppDependencies) {
setErrorFlag(false);
} catch (e) {
console.log(e);
if (e.response && e.response.status === 403) {
// requests with existing credentials but insufficient permissions result in 403, remote data-source requests with non-existing credentials result in 400
if (e.response && [400, 403].includes(e.response.status)) {
setAccessErrorFlag(true);
}
setErrorFlag(true);
Expand Down
3 changes: 2 additions & 1 deletion public/apps/configuration/panels/user-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ export function UserList(props: AppDependencies) {
setAccessErrorFlag(false);
} catch (e) {
console.log(e);
if (e.response && e.response.status === 403) {
// requests with existing credentials but insufficient permissions result in 403, remote data-source requests with non-existing credentials result in 400
if (e.response && [400, 403].includes(e.response.status)) {
setAccessErrorFlag(true);
}
setErrorFlag(true);
Expand Down

0 comments on commit a32a285

Please sign in to comment.