Skip to content

Commit

Permalink
bug: fix error page render (#1630)
Browse files Browse the repository at this point in the history
  • Loading branch information
w3cj authored Apr 2, 2024
1 parent 27bf302 commit 4e3df20
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/routes/(site)/+error.svelte

This file was deleted.

30 changes: 30 additions & 0 deletions src/routes/+error.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script lang="ts">
import { page } from '$app/stores';
import Layout from './(site)/+layout.svelte';
import type { UserWithRoles } from '$/server/auth/users';
// error page does not automatically infer layout data...
export let data: {
user: UserWithRoles,
user_theme: string;
};
$: ({ user, user_theme } = data);
</script>

<!-- Manually render (site) layout around error -->
<Layout data={{ user: user, user_theme }}>
<div>
<h2>Oopsie-daisy</h2>
{#if $page?.error?.message}
<p class="error">{$page.error.message}</p>
{:else}
<p class="error">Something went wrong. Don't worry, we use Sentry!</p>
{/if}
</div>
</Layout>

<style>
.error {
color: var(--warning);
}
</style>
File renamed without changes.

0 comments on commit 4e3df20

Please sign in to comment.