1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

refactor: fix handling of unknown error (#890)

This commit is contained in:
olav 2022-04-20 15:18:03 +02:00 committed by GitHub
parent 27a2a1a776
commit a50ab68b43

View File

@ -16,7 +16,7 @@ interface IFeatureOverviewEnvSwitchProps {
env: IFeatureEnvironment;
callback?: () => void;
text?: string;
showInfoBox?: () => void;
showInfoBox: () => void;
}
const FeatureOverviewEnvSwitch = ({
@ -44,14 +44,14 @@ const FeatureOverviewEnvSwitch = ({
if (callback) {
callback();
}
} catch (e) {
// @ts-expect-error
if (e.message === ENVIRONMENT_STRATEGY_ERROR) {
// @ts-expect-error
showInfoBox(true);
} catch (error: unknown) {
if (
error instanceof Error &&
error.message === ENVIRONMENT_STRATEGY_ERROR
) {
showInfoBox();
} else {
// @ts-expect-error
setToastApiError(e.message);
setToastApiError(formatUnknownError(error));
}
}
};