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;
|
env: IFeatureEnvironment;
|
||||||
callback?: () => void;
|
callback?: () => void;
|
||||||
text?: string;
|
text?: string;
|
||||||
showInfoBox?: () => void;
|
showInfoBox: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FeatureOverviewEnvSwitch = ({
|
const FeatureOverviewEnvSwitch = ({
|
||||||
@ -44,14 +44,14 @@ const FeatureOverviewEnvSwitch = ({
|
|||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (error: unknown) {
|
||||||
// @ts-expect-error
|
if (
|
||||||
if (e.message === ENVIRONMENT_STRATEGY_ERROR) {
|
error instanceof Error &&
|
||||||
// @ts-expect-error
|
error.message === ENVIRONMENT_STRATEGY_ERROR
|
||||||
showInfoBox(true);
|
) {
|
||||||
|
showInfoBox();
|
||||||
} else {
|
} else {
|
||||||
// @ts-expect-error
|
setToastApiError(formatUnknownError(error));
|
||||||
setToastApiError(e.message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user