From 7d1f226798baac937b1605f73fff017ab1e58698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Fri, 7 Oct 2022 17:56:04 +0200 Subject: [PATCH] Rename Error component to ErrorModal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Error` is a built-in type in typescript, we don't want to have an accidental clash. Bumped into this when doing: try { // ... } catch (error: unknown) { if(error instanceof Error) { // ... } } Signed-off-by: Rūdolfs Ošiņš --- src/Connect.svelte | 4 ++-- src/{Error.spec.ts => ErrorModal.spec.ts} | 8 ++++---- src/{Error.svelte => ErrorModal.svelte} | 0 src/Profile.svelte | 4 ++-- src/base/faucet/Withdraw.svelte | 7 +++++-- src/base/registrations/Routes.svelte | 4 ++-- src/base/registrations/Submit.svelte | 4 ++-- src/base/registrations/View.svelte | 6 +++--- src/ens/SetName.svelte | 2 +- 9 files changed, 21 insertions(+), 18 deletions(-) rename src/{Error.spec.ts => ErrorModal.spec.ts} (90%) rename src/{Error.svelte => ErrorModal.svelte} (100%) diff --git a/src/Connect.svelte b/src/Connect.svelte index 0cfd24fbe..bcc35885f 100644 --- a/src/Connect.svelte +++ b/src/Connect.svelte @@ -2,7 +2,7 @@ import { get } from "svelte/store"; import { Connection, state } from "@app/session"; import type { Err } from "@app/error"; - import Error from "@app/Error.svelte"; + import ErrorModal from "@app/ErrorModal.svelte"; import type { Config } from "@app/config"; import ConnectWallet from "@app/components/Modal/ConnectWallet.svelte"; import Button from "@app/Button.svelte"; @@ -52,7 +52,7 @@ uri={$walletConnectState.uri} on:close={onModalClose} /> {:else if error} - { it("should show passed in props", () => { - cy.mount(Error, { + cy.mount(ErrorModal, { props: { subtitle: "Subtitle of Modal", error: { @@ -21,7 +21,7 @@ describe("Error", () => { }); it("should show custom error message", () => { - cy.mount(Error, { + cy.mount(ErrorModal, { props: { subtitle: "Subtitle of Modal", message: "Error message to check for", @@ -31,7 +31,7 @@ describe("Error", () => { }); it("should change button label to Close when floating", () => { - cy.mount(Error, { + cy.mount(ErrorModal, { props: { title: "Title of Modal", subtitle: "Subtitle of Modal", diff --git a/src/Error.svelte b/src/ErrorModal.svelte similarity index 100% rename from src/Error.svelte rename to src/ErrorModal.svelte diff --git a/src/Profile.svelte b/src/Profile.svelte index b606866a7..4048e3eca 100644 --- a/src/Profile.svelte +++ b/src/Profile.svelte @@ -16,7 +16,7 @@ import { session } from "@app/session"; import { Org } from "@app/base/orgs/Org"; import Message from "@app/Message.svelte"; - import Error from "@app/Error.svelte"; + import ErrorModal from "@app/ErrorModal.svelte"; import { User } from "@app/base/users/User"; import Projects from "@app/base/seeds/View/Projects.svelte"; import { MissingReverseRecord, NotFoundError } from "@app/error"; @@ -491,6 +491,6 @@ title={addressOrName} subtitle="Sorry, the requested name has no reverse record set." /> {:else} - + {/if} {/await} diff --git a/src/base/faucet/Withdraw.svelte b/src/base/faucet/Withdraw.svelte index cae92d89b..b85013f31 100644 --- a/src/base/faucet/Withdraw.svelte +++ b/src/base/faucet/Withdraw.svelte @@ -4,7 +4,7 @@ import type { Config } from "@app/config"; import Loading from "@app/Loading.svelte"; import Modal from "@app/Modal.svelte"; - import Err from "@app/Error.svelte"; + import ErrorModal from "@app/ErrorModal.svelte"; import type { State } from "@app/utils"; import { Status } from "@app/utils"; import { withdraw } from "./lib"; @@ -51,7 +51,10 @@ {#if error} - + {:else} diff --git a/src/base/registrations/Routes.svelte b/src/base/registrations/Routes.svelte index d26587780..71bc44b22 100644 --- a/src/base/registrations/Routes.svelte +++ b/src/base/registrations/Routes.svelte @@ -4,7 +4,7 @@ import New from "@app/base/registrations/New.svelte"; import Submit from "@app/base/registrations/Submit.svelte"; import View from "@app/base/registrations/View.svelte"; - import Error from "@app/Error.svelte"; + import ErrorModal from "@app/ErrorModal.svelte"; import type { Config } from "@app/config"; import type { Session } from "@app/session"; import { getSearchParam } from "@app/utils"; @@ -29,7 +29,7 @@ owner={getSearchParam("owner", location)} {session} /> {:else} - navigate("/registrations")} /> {/if} diff --git a/src/base/registrations/Submit.svelte b/src/base/registrations/Submit.svelte index 4b7db1a39..3e0e27b8b 100644 --- a/src/base/registrations/Submit.svelte +++ b/src/base/registrations/Submit.svelte @@ -7,7 +7,7 @@ import type { Config } from "@app/config"; import Loading from "@app/Loading.svelte"; import Modal from "@app/Modal.svelte"; - import Err from "@app/Error.svelte"; + import ErrorModal from "@app/ErrorModal.svelte"; import BlockTimer from "@app/BlockTimer.svelte"; import Button from "@app/Button.svelte"; @@ -54,7 +54,7 @@ {#if error} - navigate("/registrations")} /> diff --git a/src/base/registrations/View.svelte b/src/base/registrations/View.svelte index 5c46f26a4..b53569326 100644 --- a/src/base/registrations/View.svelte +++ b/src/base/registrations/View.svelte @@ -10,7 +10,7 @@ import Form from "@app/Form.svelte"; import type { Field } from "@app/Form.svelte"; import { assert } from "@app/error"; - import Error from "@app/Error.svelte"; + import ErrorModal from "@app/ErrorModal.svelte"; import { isAddressEqual, isReverseRecordSet } from "@app/utils"; import Button from "@app/Button.svelte"; @@ -235,11 +235,11 @@ {#if state.status === Status.Loading} {:else if state.status === Status.Failed} - navigate("/registrations")}> {state.error} - + {:else if state.status === Status.NotFound} diff --git a/src/ens/SetName.svelte b/src/ens/SetName.svelte index 09cd41fe8..3a02cc92f 100644 --- a/src/ens/SetName.svelte +++ b/src/ens/SetName.svelte @@ -6,7 +6,7 @@ import { formatAddress, isAddressEqual } from "@app/utils"; import { Org } from "@app/base/orgs/Org"; import type { User } from "@app/base/users/User"; - import ErrorModal from "@app/Error.svelte"; + import ErrorModal from "@app/ErrorModal.svelte"; import Address from "@app/Address.svelte"; import * as utils from "@app/utils"; import Button from "@app/Button.svelte";