Skip to content

Commit 0d8d816

Browse files
committed
Include error message text on page
Also remove the '500' h1 from the error Closes #3248
1 parent ae1577b commit 0d8d816

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module.exports = {
5050
},
5151
],
5252
env: { browser: true, es2020: true },
53-
ignorePatterns: ["backend_proto.d.ts", "*.svelte.d.ts", "vendor", "extra/*", "vite.config.ts"],
53+
ignorePatterns: ["backend_proto.d.ts", "*.svelte.d.ts", "vendor", "extra/*", "vite.config.ts", "hooks.client.js"],
5454
globals: {
5555
globalThis: false,
5656
NodeListOf: false,

ts/routes/+error.svelte

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!--
2+
Copyright: Ankitects Pty Ltd and contributors
3+
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
4+
-->
5+
<script lang="ts">
6+
import { page } from "$app/stores";
7+
8+
$: message = $page.error!.message;
9+
</script>
10+
11+
{message}

ts/src/hooks.client.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('@sveltejs/kit').HandleClientError} */
2+
export async function handleError({ error, event, status, message }) {
3+
/** @type {any} */
4+
const anyError = error;
5+
return {
6+
message: anyError.message,
7+
};
8+
}

0 commit comments

Comments
 (0)