Skip to content

Commit

Permalink
Include error message text on page
Browse files Browse the repository at this point in the history
Also remove the '500' h1 from the error

Closes #3248
  • Loading branch information
dae committed Jun 24, 2024
1 parent ae1577b commit 0d8d816
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = {
},
],
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: {
globalThis: false,
NodeListOf: false,
Expand Down
11 changes: 11 additions & 0 deletions ts/routes/+error.svelte
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 0 deletions ts/src/hooks.client.js
Original file line number Diff line number Diff line change
@@ -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,
};
}

0 comments on commit 0d8d816

Please sign in to comment.