mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
11 lines
334 B
TypeScript
11 lines
334 B
TypeScript
// Get a human-readable error message string from a caught value.
|
|
export const formatUnknownError = (error: unknown): string => {
|
|
if (error instanceof Error) {
|
|
return error.message || error.toString();
|
|
} else if (typeof error === 'string') {
|
|
return error;
|
|
} else {
|
|
return 'Unknown error';
|
|
}
|
|
};
|