mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 08:51:24 +00:00
fix: error handling: better handle error.message undefined or '' case. (#2253)
Co-authored-by: Laurent Nguyen <languye@microsoft.com>
This commit is contained in:
@@ -23,7 +23,10 @@ export const handleError = (error: string | ARMError | Error, area: string, cons
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getErrorMessage = (error: string | Error = ""): string => {
|
export const getErrorMessage = (error: string | Error = ""): string => {
|
||||||
const errorMessage = typeof error === "string" ? error : error.message;
|
let errorMessage = typeof error === "string" ? error : error.message;
|
||||||
|
if (!errorMessage) {
|
||||||
|
errorMessage = JSON.stringify(error);
|
||||||
|
}
|
||||||
return replaceKnownError(errorMessage);
|
return replaceKnownError(errorMessage);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user