From 4c47c27d9f5946126c88805ded8fd6989a5d4f4a Mon Sep 17 00:00:00 2001 From: Ajinkya Rajandekar <145996984+ajinkyaraj-23@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:59:59 +0000 Subject: [PATCH] Remove error stacktrace for web errormodels --- .gitignore | 2 ++ apps/web/src/components/Menu/ErrorLogsMenu/ErrorLogsMenu.tsx | 3 ++- packages/utils/src/ErrorContext.ts | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 367091daca..fc27880b02 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,5 @@ docs/ storybook-static +# IDE +.idea diff --git a/apps/web/src/components/Menu/ErrorLogsMenu/ErrorLogsMenu.tsx b/apps/web/src/components/Menu/ErrorLogsMenu/ErrorLogsMenu.tsx index 9bd816a3f8..e7c508ec30 100644 --- a/apps/web/src/components/Menu/ErrorLogsMenu/ErrorLogsMenu.tsx +++ b/apps/web/src/components/Menu/ErrorLogsMenu/ErrorLogsMenu.tsx @@ -4,6 +4,7 @@ import { errorsActions, useAppDispatch, useAppSelector } from "@umami/state"; import { useColor } from "../../../styles/useColor"; import { EmptyMessage } from "../../EmptyMessage"; import { DrawerContentWrapper } from "../DrawerContentWrapper"; +import { handleTezError } from "@umami/utils"; export const ErrorLogsMenu = () => { const color = useColor(); @@ -60,7 +61,7 @@ export const ErrorLogsMenu = () => { {errorLog.technicalDetails && ( - {errorLog.technicalDetails} + {handleTezError({name: "unknown", message: errorLog.technicalDetails})} )} diff --git a/packages/utils/src/ErrorContext.ts b/packages/utils/src/ErrorContext.ts index ad5d79786a..590164ee67 100644 --- a/packages/utils/src/ErrorContext.ts +++ b/packages/utils/src/ErrorContext.ts @@ -21,7 +21,10 @@ export const handleTezError = (err: Error): string | undefined => { } else if (err.message.includes("staking_to_delegate_that_refuses_external_staking")) { return "The baker you are trying to stake to does not accept external staking."; } else if (err.message.includes("empty_implicit_delegated_contract")) { - return "Emptying an implicit delegated account is not allowed."; + return "Emptying an implicit delegated account is not allowed. End delegation before trying again."; + } + else { + return "Unknown error. Contact support team for more information."; } };