diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index 0d331425..ecfd1067 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -854,7 +854,9 @@ "captcha_failed": "Incorrect CAPTCHA answer.", "cant_block_local_instance": "You can't block the instance you are actively using.", "invalid_vote_value": "You can't commit voter fraud on Lemmy posts, sorry.", - "language_not_allowed": "That language isn't allowed in this community. Unset it to use the community's default." + "language_not_allowed": "That language isn't allowed in this community. Unset it to use the community's default.", + "couldnt_find_person": "That user doesn't exist.", + "couldnt_find_community": "That community doesn't exist." }, "aria": { "pagination": { diff --git a/src/lib/lemmy/error.ts b/src/lib/lemmy/error.ts index 4141ddec..24992b4d 100644 --- a/src/lib/lemmy/error.ts +++ b/src/lib/lemmy/error.ts @@ -6,6 +6,8 @@ export function errorMessage(error: any, instance?: string): string { error = JSON.parse(error?.body?.message).error } else if (error?.message) { error = error?.message + } else if (error?.error && typeof error?.error === 'string') { + error = error.error } if (!error) throw error diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte index 05f11688..f02b7a4a 100644 --- a/src/routes/+error.svelte +++ b/src/routes/+error.svelte @@ -1,24 +1,50 @@ -
-

-
- -
+
+

{$page.status}

- - {$page.error?.message} - - + {#if $page?.error?.message} + {@const error = getError($page?.error?.message)} + {#if error.code} + + {error.string} + + {:else} +

+ {error.string} +

+ {/if} + {/if} +
+ + +