diff --git a/ui/src/components/access/AccessEditDrawer.tsx b/ui/src/components/access/AccessEditDrawer.tsx index 5c4db4cd..feb97cc6 100644 --- a/ui/src/components/access/AccessEditDrawer.tsx +++ b/ui/src/components/access/AccessEditDrawer.tsx @@ -11,7 +11,7 @@ import { type AccessModel } from "@/domain/access"; import { ACCESS_USAGES } from "@/domain/provider"; import { useTriggerElement, useZustandShallowSelector } from "@/hooks"; import { useAccessesStore } from "@/stores/access"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; import AccessForm, { type AccessFormModes, type AccessFormProps, type AccessFormUsages } from "./AccessForm"; @@ -97,7 +97,7 @@ const AccessEditDrawer = ({ afterSubmit, mode, data, loading, trigger, usage, .. afterSubmit?.(formValues); } catch (err) { - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); throw err; } finally { @@ -146,7 +146,7 @@ const AccessEditDrawer = ({ afterSubmit, mode, data, loading, trigger, usage, .. await testPushNotification({ provider: fieldProvider, accessId: data!.id }); message.success(t("common.text.operation_succeeded")); } catch (err) { - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } finally { setIsTesting(false); } diff --git a/ui/src/components/workflow/WorkflowRunDetail.tsx b/ui/src/components/workflow/WorkflowRunDetail.tsx index b6ba5fc6..860ef16e 100644 --- a/ui/src/components/workflow/WorkflowRunDetail.tsx +++ b/ui/src/components/workflow/WorkflowRunDetail.tsx @@ -17,7 +17,7 @@ import { listByWorkflowRunId as listCertificatesByWorkflowRunId } from "@/reposi import { listByWorkflowRunId as listLogsByWorkflowRunId } from "@/repository/workflowLog"; import { subscribe as subscribeWorkflowRun } from "@/repository/workflowRun"; import { mergeCls } from "@/utils/css"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; import WorkflowDesigner from "./designer/Designer"; import WorkflowToolbar from "./designer/Toolbar"; @@ -439,7 +439,7 @@ const WorkflowRunArtifacts = ({ runId }: { runId: string }) => { } console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); throw err; }, diff --git a/ui/src/components/workflow/designer/forms/BizApplyNodeConfigForm.tsx b/ui/src/components/workflow/designer/forms/BizApplyNodeConfigForm.tsx index 2d672d5c..42cd2fe5 100644 --- a/ui/src/components/workflow/designer/forms/BizApplyNodeConfigForm.tsx +++ b/ui/src/components/workflow/designer/forms/BizApplyNodeConfigForm.tsx @@ -23,7 +23,7 @@ import { type WorkflowNodeConfigForBizApply, defaultNodeConfigForBizApply } from import { useAntdForm, useZustandShallowSelector } from "@/hooks"; import { useAccessesStore } from "@/stores/access"; import { useContactEmailsStore } from "@/stores/settings"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; import { matchSearchOption } from "@/utils/search"; import { isDomain, isHostname } from "@/utils/validator"; @@ -232,7 +232,7 @@ const BizApplyNodeConfigForm = ({ node, ...props }: BizApplyNodeConfigFormProps) { name: "keyContent", value: value, - errors: [getErrMsg(err)], + errors: [unwrapErrMsg(err)], }, ]); } diff --git a/ui/src/components/workflow/designer/forms/BizUploadNodeConfigForm.tsx b/ui/src/components/workflow/designer/forms/BizUploadNodeConfigForm.tsx index 46c815e2..5e38be26 100644 --- a/ui/src/components/workflow/designer/forms/BizUploadNodeConfigForm.tsx +++ b/ui/src/components/workflow/designer/forms/BizUploadNodeConfigForm.tsx @@ -11,7 +11,7 @@ import Show from "@/components/Show"; import Tips from "@/components/Tips"; import { type WorkflowNodeConfigForBizUpload, defaultNodeConfigForBizUpload } from "@/domain/workflow"; import { useAntdForm } from "@/hooks"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; import { isUrlWithHttpOrHttps } from "@/utils/validator"; import { getSubjectAltNames as getX509SubjectAltNames } from "@/utils/x509"; @@ -80,7 +80,7 @@ const BizUploadNodeConfigForm = ({ node, ...props }: BizUploadNodeConfigFormProp { name: "certificate", value: value, - errors: [getErrMsg(err)], + errors: [unwrapErrMsg(err)], }, ]); } @@ -100,7 +100,7 @@ const BizUploadNodeConfigForm = ({ node, ...props }: BizUploadNodeConfigFormProp { name: "privateKey", value: value, - errors: [getErrMsg(err)], + errors: [unwrapErrMsg(err)], }, ]); } diff --git a/ui/src/components/workflow/designer/forms/_shared.tsx b/ui/src/components/workflow/designer/forms/_shared.tsx index 069865ee..f4ff42be 100644 --- a/ui/src/components/workflow/designer/forms/_shared.tsx +++ b/ui/src/components/workflow/designer/forms/_shared.tsx @@ -7,7 +7,7 @@ import { Anchor, type AnchorProps, App, Button, Drawer, Dropdown, Flex, type For import { isEqual } from "radash"; import Show from "@/components/Show"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; import { type NodeRegistry } from "../nodes/typings"; @@ -60,7 +60,7 @@ export const NodeConfigDrawer = ({ children, afterClose, anchor, footer = true, node.form!.setValueIn("config", formValues); node.form!.validate(); } catch (err) { - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); throw err; } finally { diff --git a/ui/src/pages/accesses/AccessList.tsx b/ui/src/pages/accesses/AccessList.tsx index 21b10812..c4e1bfa7 100644 --- a/ui/src/pages/accesses/AccessList.tsx +++ b/ui/src/pages/accesses/AccessList.tsx @@ -17,7 +17,7 @@ import { ACCESS_USAGES, accessProvidersMap } from "@/domain/provider"; import { useAppSettings, useZustandShallowSelector } from "@/hooks"; import { get as getAccess } from "@/repository/access"; import { useAccessesStore } from "@/stores/access"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; type AccessUsages = AccessEditDrawerProps["usage"]; @@ -41,7 +41,7 @@ const AccessList = () => { } console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); }); }); @@ -327,7 +327,7 @@ const AccessList = () => { refreshData(); } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }, }); @@ -359,7 +359,7 @@ const AccessList = () => { } } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }, }); @@ -429,7 +429,7 @@ const AccessList = () => { } extra={ loadError ? ( diff --git a/ui/src/pages/accesses/AccessNew.tsx b/ui/src/pages/accesses/AccessNew.tsx index 0543af18..dc0ce09d 100644 --- a/ui/src/pages/accesses/AccessNew.tsx +++ b/ui/src/pages/accesses/AccessNew.tsx @@ -10,7 +10,7 @@ import { type AccessModel } from "@/domain/access"; import { ACCESS_USAGES } from "@/domain/provider"; import { useZustandShallowSelector } from "@/hooks"; import { useAccessesStore } from "@/stores/access"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; const AccessNew = () => { const navigate = useNavigate(); @@ -51,7 +51,7 @@ const AccessNew = () => { navigate(`/accesses?usage=${providerUsage}`, { replace: true }); } catch (err) { - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); throw err; } finally { diff --git a/ui/src/pages/certificates/CertificateList.tsx b/ui/src/pages/certificates/CertificateList.tsx index fa58853a..8dee4887 100644 --- a/ui/src/pages/certificates/CertificateList.tsx +++ b/ui/src/pages/certificates/CertificateList.tsx @@ -15,7 +15,7 @@ import { CERTIFICATE_SOURCES, type CertificateModel } from "@/domain/certificate import { useAppSettings, useZustandShallowSelector } from "@/hooks"; import { get as getCertificate, list as listCertificates, remove as removeCertificate } from "@/repository/certificate"; import { usePersistenceSettingsStore } from "@/stores/settings"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; const CertificateList = () => { const navigate = useNavigate(); @@ -290,7 +290,7 @@ const CertificateList = () => { } console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); throw err; }, @@ -343,7 +343,7 @@ const CertificateList = () => { } } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }, }); @@ -371,7 +371,7 @@ const CertificateList = () => { } } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }, }); @@ -403,7 +403,7 @@ const CertificateList = () => { } } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }, }); @@ -463,7 +463,7 @@ const CertificateList = () => { } extra={ loadError ? ( diff --git a/ui/src/pages/dashboard/Dashboard.tsx b/ui/src/pages/dashboard/Dashboard.tsx index 405e5ecf..b847c314 100644 --- a/ui/src/pages/dashboard/Dashboard.tsx +++ b/ui/src/pages/dashboard/Dashboard.tsx @@ -30,7 +30,7 @@ import { type WorkflowRunModel } from "@/domain/workflowRun"; import { useBrowserTheme, useVersionChecker } from "@/hooks"; import { get as getWorkflowRun, list as listWorkflowRuns } from "@/repository/workflowRun"; import { mergeCls } from "@/utils/css"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; const Dashboard = () => { const { t } = useTranslation(); @@ -149,7 +149,7 @@ const StatisticCards = ({ className, style }: { className?: string; style?: Reac } console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); throw err; }, @@ -365,7 +365,7 @@ const WorkflowRunHistoryTable = ({ className, style }: { className?: string; sty } console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); throw err; }, @@ -400,7 +400,7 @@ const WorkflowRunHistoryTable = ({ className, style }: { className?: string; sty } extra={ loadError ? ( diff --git a/ui/src/pages/login/Login.tsx b/ui/src/pages/login/Login.tsx index 9cc9768b..45cf9efd 100644 --- a/ui/src/pages/login/Login.tsx +++ b/ui/src/pages/login/Login.tsx @@ -13,7 +13,7 @@ import AppVersion from "@/components/AppVersion"; import { useAntdForm, useBrowserTheme } from "@/hooks"; import { authWithPassword } from "@/repository/admin"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; const Login = () => { const navigage = useNavigate(); @@ -59,7 +59,7 @@ const Login = () => { await authWithPassword(values.username, values.password); await navigage("/"); } catch (err) { - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); throw err; } diff --git a/ui/src/pages/presets/PresetListNotifyTemplates.tsx b/ui/src/pages/presets/PresetListNotifyTemplates.tsx index 6f0cbdc8..19b8d5f3 100644 --- a/ui/src/pages/presets/PresetListNotifyTemplates.tsx +++ b/ui/src/pages/presets/PresetListNotifyTemplates.tsx @@ -12,7 +12,7 @@ import DrawerForm from "@/components/DrawerForm"; import Tips from "@/components/Tips"; import { useAntdForm, useZustandShallowSelector } from "@/hooks"; import { useNotifyTemplatesStore } from "@/stores/settings"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; const MAX_TEMPLATE_COUNT = 99; @@ -35,7 +35,7 @@ const PresetListNotifyTemplates = () => { } console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); }); }); @@ -77,7 +77,7 @@ const PresetListNotifyTemplates = () => { await removeTemplateByIndex(index); } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }, }); @@ -90,7 +90,7 @@ const PresetListNotifyTemplates = () => { setCreateDrawerOpen(false); } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }; @@ -105,7 +105,7 @@ const PresetListNotifyTemplates = () => { setDetailDrawerOpen(false); } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }; diff --git a/ui/src/pages/presets/PresetListScriptTemplates.tsx b/ui/src/pages/presets/PresetListScriptTemplates.tsx index a0adfda0..0b12029a 100644 --- a/ui/src/pages/presets/PresetListScriptTemplates.tsx +++ b/ui/src/pages/presets/PresetListScriptTemplates.tsx @@ -13,7 +13,7 @@ import DrawerForm from "@/components/DrawerForm"; import Tips from "@/components/Tips"; import { useAntdForm, useZustandShallowSelector } from "@/hooks"; import { useScriptTemplatesStore } from "@/stores/settings"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; const MAX_TEMPLATE_COUNT = 99; @@ -35,7 +35,7 @@ const PresetListScriptTemplates = () => { } console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); }); }); @@ -77,7 +77,7 @@ const PresetListScriptTemplates = () => { await removeTemplateByIndex(index); } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }, }); @@ -90,7 +90,7 @@ const PresetListScriptTemplates = () => { setCreateDrawerOpen(false); } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }; @@ -105,7 +105,7 @@ const PresetListScriptTemplates = () => { setDetailDrawerOpen(false); } catch (err) { console.error(err); - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); } }; diff --git a/ui/src/pages/settings/SettingsAccount.tsx b/ui/src/pages/settings/SettingsAccount.tsx index 23bd4293..48f5001c 100644 --- a/ui/src/pages/settings/SettingsAccount.tsx +++ b/ui/src/pages/settings/SettingsAccount.tsx @@ -7,7 +7,7 @@ import { z } from "zod"; import { useAntdForm } from "@/hooks"; import { authWithPassword, getAuthStore, save as saveAdmin } from "@/repository/admin"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; const SettingsAccount = () => { const { t } = useTranslation(); @@ -60,7 +60,7 @@ const SettingsAccountUsername = ({ className, style }: { className?: string; sty navigate("/login"); }, 500); } catch (err) { - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); throw err; } @@ -163,7 +163,7 @@ const SettingsAccountPassword = ({ className, style }: { className?: string; sty navigate("/login"); }, 500); } catch (err) { - notification.error({ title: t("common.text.request_error"), description: getErrMsg(err) }); + notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) }); throw err; } diff --git a/ui/src/pages/settings/SettingsDiagnostics.tsx b/ui/src/pages/settings/SettingsDiagnostics.tsx index b8be956f..bbe0dd62 100644 --- a/ui/src/pages/settings/SettingsDiagnostics.tsx +++ b/ui/src/pages/settings/SettingsDiagnostics.tsx @@ -10,7 +10,7 @@ import Show from "@/components/Show"; import { listCronJobs, listLogs } from "@/repository/system"; import { getNextCronExecutions } from "@/utils/cron"; import { mergeCls } from "@/utils/css"; -import { getErrMsg } from "@/utils/error"; +import { unwrapErrMsg } from "@/utils/error"; const SettingsDiagnostics = () => { const { t } = useTranslation(); @@ -139,7 +139,7 @@ const SettingsDiagnosticsLogs = ({ className, style }: { className?: string; sty
-
{loadError ? `> ${getErrMsg(loadError)}` : "> no logs avaiable"}
+
{loadError ? `> ${unwrapErrMsg(loadError)}` : "> no logs avaiable"}
@@ -241,7 +241,7 @@ const SettingsDiagnosticsCrons = ({ className, style }: { className?: string; st loading={loading} locale={{ emptyText: ( - + {loadError && (