Make a missing reverse record error less critical

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2022-08-24 11:41:09 +02:00
committed by Alexis Sellier
parent 3f373ff9d6
commit 7304d1f429
3 changed files with 15 additions and 3 deletions
+3 -1
View File
@@ -17,7 +17,7 @@
import Error from '@app/Error.svelte';
import { User } from '@app/base/users/User';
import Projects from '@app/base/orgs/View/Projects.svelte';
import { NotFoundError } from '@app/error';
import { MissingReverseRecord, NotFoundError } from '@app/error';
import NotFound from '@app/NotFound.svelte';
import RadicleUrn from '@app/RadicleUrn.svelte';
@@ -399,6 +399,8 @@
{:catch err}
{#if err instanceof NotFoundError}
<NotFound title={addressOrName} subtitle="Sorry, the requested address or domain was not found." />
{:else if err instanceof MissingReverseRecord}
<NotFound title={addressOrName} subtitle="Sorry, the requested name has no reverse record set." />
{:else}
<Error error={err} />
{/if}
+10
View File
@@ -34,6 +34,16 @@ export class NotFoundError extends Error {
}
}
export class MissingReverseRecord extends Error {
constructor(message?: string) {
if (message) {
super(`missing reverse record: ${message}`);
} else {
super(`missing reverse record`);
}
}
}
class AssertionError extends Error {
constructor(message?: string) {
if (message) {
+2 -2
View File
@@ -8,7 +8,7 @@ import type { Config } from "@app/config";
import { cached } from "@app/cache";
import type { Seed, InvalidSeed } from "@app/base/seeds/Seed";
import { Org } from "@app/base/orgs/Org";
import { NotFoundError } from "@app/error";
import { NotFoundError, MissingReverseRecord } from "@app/error";
import { getProjectAnchors } from "@app/anchors";
import type { Anchor, PendingAnchor } from "@app/project";
@@ -208,7 +208,7 @@ export class Profile {
org: org ?? undefined
};
}
throw new Error(`No address set for ${addressOrName}`);
throw new MissingReverseRecord(`No address set for ${addressOrName}`);
} else if (isAddress(addressOrName)) {
const address = addressOrName.toLowerCase();