Include error message text on page

Also remove the '500' h1 from the error

Closes #3248
This commit is contained in:
Damien Elmes 2024-06-24 15:24:23 +07:00
parent ae1577b228
commit 0d8d816a0c
3 changed files with 20 additions and 1 deletions

View File

@ -50,7 +50,7 @@ module.exports = {
}, },
], ],
env: { browser: true, es2020: true }, env: { browser: true, es2020: true },
ignorePatterns: ["backend_proto.d.ts", "*.svelte.d.ts", "vendor", "extra/*", "vite.config.ts"], ignorePatterns: ["backend_proto.d.ts", "*.svelte.d.ts", "vendor", "extra/*", "vite.config.ts", "hooks.client.js"],
globals: { globals: {
globalThis: false, globalThis: false,
NodeListOf: false, NodeListOf: false,

11
ts/routes/+error.svelte Normal file
View File

@ -0,0 +1,11 @@
<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import { page } from "$app/stores";
$: message = $page.error!.message;
</script>
{message}

8
ts/src/hooks.client.js Normal file
View File

@ -0,0 +1,8 @@
/** @type {import('@sveltejs/kit').HandleClientError} */
export async function handleError({ error, event, status, message }) {
/** @type {any} */
const anyError = error;
return {
message: anyError.message,
};
}