From a4d94f522ab3029825615e277a5e3486b0e1c284 Mon Sep 17 00:00:00 2001 From: Admin Date: Mon, 30 Mar 2026 23:00:00 +0500 Subject: [PATCH] feat: styled error pages for all error surfaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ui/src/error.html: custom SvelteKit last-resort fallback (replaces the bare '500 | Internal Error' shown when +error.svelte itself fails) — branded, auto-refreshes in 20s, book+lightning SVG illustration - ui/src/routes/+error.svelte: improved with context-aware SVG illustrations (question mark book for 404, lightning bolt for 5xx), larger status watermark, and a Retry button on non-404 errors - caddy/errors/500.html: new static error page matching the 502/503/504 design — served by Caddy when a gateway-level 500 occurs - Caddyfile: add handle_errors 500 block pointing at /srv/errors/500.html - caddy/Dockerfile: COPY errors/ into image so static pages are baked in --- Caddyfile | 5 + caddy/Dockerfile | 1 + caddy/errors/500.html | 203 ++++++++++++++++++++++++++++++++++ ui/src/error.html | 209 ++++++++++++++++++++++++++++++++++++ ui/src/routes/+error.svelte | 61 +++++++++-- 5 files changed, 470 insertions(+), 9 deletions(-) create mode 100644 caddy/errors/500.html create mode 100644 ui/src/error.html diff --git a/Caddyfile b/Caddyfile index cc9fc4e..392df74 100644 --- a/Caddyfile +++ b/Caddyfile @@ -211,6 +211,11 @@ rewrite * /404.html file_server } + handle_errors 500 { + root * /srv/errors + rewrite * /500.html + file_server + } handle_errors 502 { root * /srv/errors rewrite * /502.html diff --git a/caddy/Dockerfile b/caddy/Dockerfile index d32d510..d78156e 100644 --- a/caddy/Dockerfile +++ b/caddy/Dockerfile @@ -7,3 +7,4 @@ RUN xcaddy build \ FROM caddy:2-alpine COPY --from=builder /usr/bin/caddy /usr/bin/caddy +COPY errors/ /srv/errors/ diff --git a/caddy/errors/500.html b/caddy/errors/500.html new file mode 100644 index 0000000..d733bb7 --- /dev/null +++ b/caddy/errors/500.html @@ -0,0 +1,203 @@ + + + + + + 500 — Internal Error — LibNovel + + + + +
+ +
+ +
+ + + +
500
+ +
+
+ Internal error +
+ +

Something went wrong

+

An unexpected error occurred on our end. We're on it — try again in a moment.

+ +
+ Go home + +
+ +

Auto-refreshing in 20s

+
+ + + + + + + diff --git a/ui/src/error.html b/ui/src/error.html new file mode 100644 index 0000000..0354524 --- /dev/null +++ b/ui/src/error.html @@ -0,0 +1,209 @@ + + + + + + %sveltekit.status% — LibNovel + + + + +
+ +
+ +
+ + + +
%sveltekit.status%
+ +
+
+ Something went wrong +
+ +

The page couldn't load

+

An unexpected error occurred. We're looking into it — try again in a moment.

+ +
+ Go home + +
+ +

Auto-refreshing in 20s

+
+ + + + + + + diff --git a/ui/src/routes/+error.svelte b/ui/src/routes/+error.svelte index c557a1d..8cc605b 100644 --- a/ui/src/routes/+error.svelte +++ b/ui/src/routes/+error.svelte @@ -17,35 +17,78 @@ ); const code = $derived(String(status)); + const is404 = $derived(status === 404); {m.error_status({ status: code })} · libnovel - -
- -

+

+ + + {#if is404} + + + {:else} + + + {/if} + + +

{code}

-
+

{title}

{description}

-
+
{m.error_go_home()} + {#if !is404} + + {/if}
-

libnovel

+

libnovel