diff --git a/apps/desktop/src/components/Onboarding/restoreBackupFile/RestoreBackupFile.test.tsx b/apps/desktop/src/components/Onboarding/restoreBackupFile/RestoreBackupFile.test.tsx
index 2b34f1ac28..790f198cf4 100644
--- a/apps/desktop/src/components/Onboarding/restoreBackupFile/RestoreBackupFile.test.tsx
+++ b/apps/desktop/src/components/Onboarding/restoreBackupFile/RestoreBackupFile.test.tsx
@@ -1,5 +1,6 @@
import { mockToast, useRestoreBackup } from "@umami/state";
import { fileUploadMock, umamiBackup } from "@umami/test-utils";
+import { CustomError } from "@umami/utils";
import { RestoreBackupFile } from "./RestoreBackupFile";
import {
@@ -41,7 +42,9 @@ describe("", () => {
it("shows error for wrong backup file format", async () => {
jest
.mocked(useRestoreBackup)
- .mockImplementation(() => jest.fn(() => Promise.reject("Invalid backup file.")));
+ .mockImplementation(() =>
+ jest.fn(() => Promise.reject(new CustomError("Invalid backup file.")))
+ );
const user = userEvent.setup();
render();
diff --git a/apps/desktop/src/components/SendFlow/Delegation/FormPage.test.tsx b/apps/desktop/src/components/SendFlow/Delegation/FormPage.test.tsx
index c9e73e7d6b..f41a8b2468 100644
--- a/apps/desktop/src/components/SendFlow/Delegation/FormPage.test.tsx
+++ b/apps/desktop/src/components/SendFlow/Delegation/FormPage.test.tsx
@@ -8,6 +8,7 @@ import {
} from "@umami/core";
import { type UmamiStore, addTestAccount, assetsActions, makeStore, mockToast } from "@umami/state";
import { executeParams } from "@umami/test-utils";
+import { CustomError } from "@umami/utils";
import { FormPage, type FormValues } from "./FormPage";
import { SignPage } from "./SignPage";
@@ -158,7 +159,7 @@ describe("
", () => {
});
const estimateMock = jest.mocked(estimate);
- estimateMock.mockRejectedValue(new Error("Some error occurred"));
+ estimateMock.mockRejectedValue(new CustomError("Some error occurred"));
await act(() => user.click(submitButton));
diff --git a/apps/desktop/src/components/SendFlow/Tez/FormPage.test.tsx b/apps/desktop/src/components/SendFlow/Tez/FormPage.test.tsx
index 24cb6b3799..f6e390ce75 100644
--- a/apps/desktop/src/components/SendFlow/Tez/FormPage.test.tsx
+++ b/apps/desktop/src/components/SendFlow/Tez/FormPage.test.tsx
@@ -8,6 +8,7 @@ import {
} from "@umami/core";
import { type UmamiStore, addTestAccount, makeStore, mockToast } from "@umami/state";
import { executeParams } from "@umami/test-utils";
+import { CustomError } from "@umami/utils";
import { FormPage, type FormValues } from "./FormPage";
import { SignPage } from "./SignPage";
@@ -241,7 +242,7 @@ describe("", () => {
const submitButton = screen.getByText("Preview");
await waitFor(() => expect(submitButton).toBeEnabled());
const estimateMock = jest.mocked(estimate);
- estimateMock.mockRejectedValue(new Error("Some error occurred"));
+ estimateMock.mockRejectedValue(new CustomError("Some error occurred"));
await act(() => user.click(submitButton));
diff --git a/apps/desktop/src/components/SendFlow/Undelegation/FormPage.test.tsx b/apps/desktop/src/components/SendFlow/Undelegation/FormPage.test.tsx
index 81c0f0fe1f..644d3f0e5c 100644
--- a/apps/desktop/src/components/SendFlow/Undelegation/FormPage.test.tsx
+++ b/apps/desktop/src/components/SendFlow/Undelegation/FormPage.test.tsx
@@ -15,6 +15,7 @@ import {
} from "@umami/state";
import { executeParams } from "@umami/test-utils";
import { mockImplicitAddress } from "@umami/tezos";
+import { CustomError } from "@umami/utils";
import { FormPage, type FormValues } from "./FormPage";
import { SignPage } from "./SignPage";
@@ -98,7 +99,7 @@ describe("", () => {
);
const estimateMock = jest.mocked(estimate);
- estimateMock.mockRejectedValue(new Error("Some error occurred"));
+ estimateMock.mockRejectedValue(new CustomError("Some error occurred"));
const submitButton = screen.getByText("Preview");
await waitFor(() => expect(submitButton).toBeEnabled());
diff --git a/apps/desktop/src/utils/beacon/useHandleBeaconMessage.test.tsx b/apps/desktop/src/utils/beacon/useHandleBeaconMessage.test.tsx
index 0347013a1c..05f3a45112 100644
--- a/apps/desktop/src/utils/beacon/useHandleBeaconMessage.test.tsx
+++ b/apps/desktop/src/utils/beacon/useHandleBeaconMessage.test.tsx
@@ -12,6 +12,7 @@ import { estimate, makeAccountOperations, mockImplicitAccount } from "@umami/cor
import { type UmamiStore, WalletClient, addTestAccount, makeStore, mockToast } from "@umami/state";
import { executeParams } from "@umami/test-utils";
import { mockImplicitAddress } from "@umami/tezos";
+import { CustomError } from "@umami/utils";
import { useHandleBeaconMessage } from "./useHandleBeaconMessage";
import { BatchSignPage } from "../../components/SendFlow/Beacon/BatchSignPage";
@@ -251,7 +252,7 @@ describe("", () => {
});
it("doesn't open a modal on an error while estimating the fee", async () => {
- jest.mocked(estimate).mockRejectedValueOnce(new Error("Something went very wrong!"));
+ jest.mocked(estimate).mockRejectedValueOnce(new CustomError("Something went very wrong!"));
const message: BeaconRequestOutputMessage = {
type: BeaconMessageType.OperationRequest,
diff --git a/apps/desktop/src/views/batch/BatchView.test.tsx b/apps/desktop/src/views/batch/BatchView.test.tsx
index 333aaee8e3..9567a18565 100644
--- a/apps/desktop/src/views/batch/BatchView.test.tsx
+++ b/apps/desktop/src/views/batch/BatchView.test.tsx
@@ -9,6 +9,7 @@ import {
} from "@umami/core";
import { type UmamiStore, addTestAccount, makeStore, mockToast } from "@umami/state";
import { executeParams } from "@umami/test-utils";
+import { CustomError } from "@umami/utils";
import { BatchView } from "./BatchView";
import { act, render, screen, userEvent, within } from "../../mocks/testUtils";
@@ -85,7 +86,7 @@ describe("", () => {
it("doesn't show up if the estimation fails with an unknown error", async () => {
const user = userEvent.setup();
- jest.mocked(estimate).mockRejectedValue(new Error("something went wrong"));
+ jest.mocked(estimate).mockRejectedValue(new CustomError("something went wrong"));
render(, { store });
diff --git a/apps/web/src/components/SendFlow/Delegation/FormPage.test.tsx b/apps/web/src/components/SendFlow/Delegation/FormPage.test.tsx
index a1b70e6df7..9eccca1c64 100644
--- a/apps/web/src/components/SendFlow/Delegation/FormPage.test.tsx
+++ b/apps/web/src/components/SendFlow/Delegation/FormPage.test.tsx
@@ -8,6 +8,7 @@ import {
mockToast,
} from "@umami/state";
import { executeParams } from "@umami/test-utils";
+import { CustomError } from "@umami/utils";
import { FormPage, type FormValues } from "./FormPage";
import { SignPage } from "./SignPage";
@@ -112,14 +113,13 @@ describe("", () => {
});
const estimateMock = jest.mocked(estimate);
- estimateMock.mockRejectedValue(new Error("Some error occurred"));
+ estimateMock.mockRejectedValue(new CustomError("Some error occurred"));
await act(() => user.click(submitButton));
expect(estimateMock).toHaveBeenCalledTimes(1);
expect(mockToast).toHaveBeenCalledWith({
- description:
- "Something went wrong. Please try again or contact support if the issue persists.",
+ description: "Some error occurred",
status: "error",
isClosable: true,
});
diff --git a/apps/web/src/components/SendFlow/Tez/FormPage.test.tsx b/apps/web/src/components/SendFlow/Tez/FormPage.test.tsx
index 795f8d4e47..182a36d5b3 100644
--- a/apps/web/src/components/SendFlow/Tez/FormPage.test.tsx
+++ b/apps/web/src/components/SendFlow/Tez/FormPage.test.tsx
@@ -7,6 +7,7 @@ import {
} from "@umami/core";
import { type UmamiStore, addTestAccount, makeStore, mockToast } from "@umami/state";
import { executeParams } from "@umami/test-utils";
+import { CustomError } from "@umami/utils";
import { FormPage } from "./FormPage";
import { SignPage } from "./SignPage";
@@ -167,14 +168,13 @@ describe("", () => {
const submitButton = screen.getByText("Preview");
await waitFor(() => expect(submitButton).toBeEnabled());
const estimateMock = jest.mocked(estimate);
- estimateMock.mockRejectedValue(new Error("Some error occurred"));
+ estimateMock.mockRejectedValue(new CustomError("Some error occurred"));
await act(() => user.click(submitButton));
expect(estimateMock).toHaveBeenCalledTimes(1);
expect(mockToast).toHaveBeenCalledWith({
- description:
- "Something went wrong. Please try again or contact support if the issue persists.",
+ description: "Some error occurred",
status: "error",
isClosable: true,
});
diff --git a/apps/web/src/components/SendFlow/Undelegation/FormPage.test.tsx b/apps/web/src/components/SendFlow/Undelegation/FormPage.test.tsx
index 9be65808b9..d71e2b16a4 100644
--- a/apps/web/src/components/SendFlow/Undelegation/FormPage.test.tsx
+++ b/apps/web/src/components/SendFlow/Undelegation/FormPage.test.tsx
@@ -14,6 +14,7 @@ import {
} from "@umami/state";
import { executeParams } from "@umami/test-utils";
import { mockImplicitAddress } from "@umami/tezos";
+import { CustomError } from "@umami/utils";
import { FormPage, type FormValues } from "./FormPage";
import { SignPage } from "./SignPage";
@@ -93,7 +94,7 @@ describe("", () => {
);
const estimateMock = jest.mocked(estimate);
- estimateMock.mockRejectedValue(new Error("Some error occurred"));
+ estimateMock.mockRejectedValue(new CustomError("Some error occurred"));
const submitButton = screen.getByText("Preview");
await waitFor(() => expect(submitButton).toBeEnabled());
diff --git a/apps/web/src/components/beacon/useHandleBeaconMessage.test.tsx b/apps/web/src/components/beacon/useHandleBeaconMessage.test.tsx
index b1a16cd6f9..75144ee224 100644
--- a/apps/web/src/components/beacon/useHandleBeaconMessage.test.tsx
+++ b/apps/web/src/components/beacon/useHandleBeaconMessage.test.tsx
@@ -12,6 +12,7 @@ import { estimate, makeAccountOperations, mockImplicitAccount } from "@umami/cor
import { type UmamiStore, WalletClient, addTestAccount, makeStore, mockToast } from "@umami/state";
import { executeParams } from "@umami/test-utils";
import { mockImplicitAddress } from "@umami/tezos";
+import { CustomError } from "@umami/utils";
import { useHandleBeaconMessage } from "./useHandleBeaconMessage";
import { BatchSignPage } from "../../components/SendFlow/Beacon/BatchSignPage";
@@ -251,7 +252,7 @@ describe("", () => {
});
it("doesn't open a modal on an error while estimating the fee", async () => {
- jest.mocked(estimate).mockRejectedValueOnce(new Error("Something went very wrong!"));
+ jest.mocked(estimate).mockRejectedValueOnce(new CustomError("Something went very wrong!"));
const message: BeaconRequestOutputMessage = {
type: BeaconMessageType.OperationRequest,
diff --git a/packages/tezos/src/helpers.ts b/packages/tezos/src/helpers.ts
index ae873ab577..3e2f5ad4bf 100644
--- a/packages/tezos/src/helpers.ts
+++ b/packages/tezos/src/helpers.ts
@@ -130,6 +130,6 @@ export const decryptSecretKey = async (secretKey: string, password: string) => {
throw new CustomError("Invalid secret key: checksum doesn't match");
}
- throw error;
+ throw new CustomError(error.message);
}
};