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:
parent
27a2a1a776
commit
a50ab68b43
@ -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));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user