Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make error page return correct error code #548

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/lib/components/layout/ErrorPage.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script lang="ts">
import { page } from "$app/stores";
import { codeToMessage } from "$lib/utils/codeToMessage";
import * as m from "$paraglide/messages";
</script>

<main class="gap flex flex-1 flex-col items-center gap-2 pt-20">
<main class="gap mx-auto flex flex-1 flex-col items-center gap-2 pt-20">
<h1 class="text-6xl font-bold">{$page.status}</h1>
<h3>
{($page.error?.statusDescription ?? $page.status in codeToMessage)
Expand All @@ -13,4 +14,30 @@
{#if $page.error?.message}
<h2 class="mt-4 text-center text-xl">{$page.error.message}</h2>
{/if}

<div class="flex flex-row gap-5 pt-10">
<a href="/" class="btn btn-primary text-lg">
{m.home()} <span class="i-mdi-house" />
</a>

<button class="btn btn-secondary text-lg" on:click={() => history.back()}>
{m.back()} <span class="i-mdi-keyboard-backspace" />
</button>
</div>
<div class="pt-16 text-center text-lg">
<div class="pb-2">{m.error_should_not_happen()}</div>
<div class="flex flex-row items-center gap-3">
<a
href="https://github.com/Dsek-LTH/web/issues/new"
class="btn btn-ghost text-lg"
>
{m.error_create_issue()} <span class="i-mdi-bug" />
</a>

<span class="text-xl font-extrabold">{m.error_or()}</span>
<a href="mailto:[email protected]" class="btn btn-ghost text-lg"
>{m.error_contact()} <span class="i-mdi-email" /></a
>
</div>
</div>
</main>
5 changes: 0 additions & 5 deletions src/routes/(app)/+error.svelte

This file was deleted.

15 changes: 0 additions & 15 deletions src/routes/(app)/[...path]/+page.server.ts

This file was deleted.

7 changes: 6 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -758,5 +758,10 @@
"nollning_events_ticketCTA": "Ticket/Register",
"home_volunteer": "Volunteer",
"committees_cafe_openinghours": "Opening hours",
"committees_cafe_thecafe": "The Cafe"
"committees_cafe_thecafe": "The Cafe",
"error_create_issue": "Create an issue",
"error_should_not_happen": "If you think this shouldn't happen please",
"error_or": "or",
"error_contact": "Contact DWWW",
"back": "Back"
}
7 changes: 6 additions & 1 deletion src/translations/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -754,5 +754,10 @@
"nollning_events_ticketCTA": "Biljett/Anmälan",
"home_volunteer": "Funktionär",
"committees_cafe_openinghours": "Öppettider",
"committees_cafe_thecafe": "Caféet"
"committees_cafe_thecafe": "Caféet",
"error_create_issue": "Skapa en issue",
"error_should_not_happen": "Om du tror att detta inte bör hända",
"error_or": "eller",
"error_contact": "Kontakta DWWW",
"back": "Tillbaka"
}
Loading