8000 fix(admin-ui): replace explicit `catch (error: any)` with proper types by pierluigilenoci · Pull Request #47397 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/apps/admin-ui/src/authentication/FlowDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default function FlowDetails() {
}
refresh();
addAlert(t("updateFlowSuccess"), AlertVariant.success);
} catch (error: any) {
} catch (error) {
addError("updateFlowError", error);
}
};
Expand All @@ -182,7 +182,7 @@ export default function FlowDetails() {
);
refresh();
addAlert(t("updateFlowSuccess"), AlertVariant.success);
} catch (error: any) {
} catch (error) {
addError("updateFlowError", error);
}
};
Expand Down
18 changes: 8 additions & 10 deletions js/apps/admin-ui/src/authentication/form/CreateFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import {
import { FormProvider, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom";
import { FormSubmitButton, SelectControl } from "@keycloak/keycloak-ui-shared";
import {
FormSubmitButton,
SelectControl,
useAlerts,
} from "@keycloak/keycloak-ui-shared";
import { useAdminClient } from "../../admin-client";
import { useAlerts } from "@keycloak/keycloak-ui-shared";
import { FormAccess } from "../../components/form/FormAccess";
import { ViewHeader } from "../../components/view-header/ViewHeader";
import { useRealm } from "../../context/realm-context/RealmContext";
Expand All @@ -26,7 +29,7 @@ export default function CreateFlow() {
const { t } = useTranslation();
const navigate = useNavigate();
const { realm } = useRealm();
const { addAlert } = useAlerts();
const { addAlert, addError } = useAlerts();
const form = useForm<AuthenticationFlowRepresentation>();
const { handleSubmit, formState } = form;

Expand All @@ -44,13 +47,8 @@ export default function CreateFlow() {
usedBy: "notInUse",
}),
);
} catch (error: any) {
addAlert(
t("flowCreateError", {
error: error.response?.data?.errorMessage || error,
}),
AlertVariant.danger,
);
} catch (error) {
addError("flowCreateError", error);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const PasswordPolicy = ({
setupForm(updatedRealm);
refresh();
addAlert(t("updatePasswordPolicySuccess"), AlertVariant.success);
} catch (error: any) {
} catch (error) {
addError("updatePasswordPolicyError", error);
}
};
Expand Down
9 changes: 3 additions & 6 deletions js/apps/admin-ui/src/client-scopes/ClientScopesSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Link } from "react-router-dom";
import { useAdminClient } from "../admin-client";
import type { Row } from "../clients/scopes/ClientScopes";
import { getProtocolName } from "../clients/utils";
import { useAlerts } from "@keycloak/keycloak-ui-shared";
import { getErrorMessage, useAlerts } from "@keycloak/keycloak-ui-shared";
import {
AllClientScopeType,
AllClientScopes,
Expand Down Expand Up @@ -166,11 +166,8 @@ export default function ClientScopesSection() {
for (const scope of selectedScopes) {
try {
await removeScope(adminClient, scope);
} catch (error: any) {
console.warn(
"could not remove scope",
error.response?.data?.errorMessage || error,
);
} catch (error) {
console.warn("could not remove scope", getErrorMessage(error));
}
await adminClient.clientScopes.del({ id: scope.id! });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function AddJWTAuthorizationGrantConnect() {
tab: "settings",
}),
);
} catch (error: any) {
} catch (error) {
addError("createIdentityProviderError", error);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function AddKubernetesConnect() {
tab: "settings",
}),
);
} catch (error: any) {
} catch (error) {
addError("createIdentityProviderError", error);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function AddSamlConnect() {
tab: "settings",
}),
);
} catch (error: any) {
} catch (error) {
addError("createIdentityProviderError", error);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function AddSamlConnect() {
tab: "settings",
}),
);
} catch (error: any) {
} catch (error) {
addError("createIdentityProviderError", error);
}
};
Expand Down
Loading
0