mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
feat: Improve formatting error messages from apiKube
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
bf6af58d80
commit
3439472065
@ -2,6 +2,9 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { JsonApiErrorParsed } from "../k8s-api/json-api";
|
||||
|
||||
export const getErrorMessage = (error: unknown): string => {
|
||||
if (typeof error === "string") {
|
||||
return error;
|
||||
@ -11,5 +14,9 @@ export const getErrorMessage = (error: unknown): string => {
|
||||
return error.message;
|
||||
}
|
||||
|
||||
if (error instanceof JsonApiErrorParsed) {
|
||||
return error.toString();
|
||||
}
|
||||
|
||||
return JSON.stringify(error);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user