Skip to content

Commit 3b34bc6

Browse files
authored
nicer error page (#214)
1 parent 9b99248 commit 3b34bc6

File tree

2 files changed

+48
-30
lines changed

2 files changed

+48
-30
lines changed

apps/svelte.dev/src/routes/+error.svelte

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,59 @@
1212
<title>{$page.status}</title>
1313
</svelte:head>
1414

15-
<div class="container">
16-
{#if online}
17-
{#if $page.status === 404}
18-
<h1>Not found!</h1>
19-
<p>
20-
If you were expecting to find something here, please drop by the
21-
<a href="/chat"> Discord chatroom </a>
22-
and let us know, or raise an issue on
23-
<a href="https://github.com/sveltejs/sites">GitHub</a>. Thanks!
24-
</p>
25-
{:else}
26-
<h1>Yikes!</h1>
27-
<p>Something went wrong when we tried to render this page.</p>
28-
{#if $page.error?.message}
29-
<p class="error">{$page.status}: {$page.error.message}</p>
15+
<div class="outer">
16+
<div class="inner">
17+
{#if online}
18+
{#if $page.status === 404}
19+
<h1>Not found!</h1>
20+
<p>
21+
If you were expecting to find something here, please drop by the
22+
<a href="/chat"> Discord chatroom </a>
23+
and let us know, or raise an issue on
24+
<a href="https://github.com/sveltejs/sites">GitHub</a>. Thanks!
25+
</p>
3026
{:else}
31-
<p class="error">Encountered a {$page.status} error.</p>
27+
<h1>Yikes!</h1>
28+
<p>Something went wrong when we tried to render this page.</p>
29+
{#if $page.error?.message}
30+
<p class="error">{$page.status}: {$page.error.message}</p>
31+
{:else}
32+
<p class="error">Encountered a {$page.status} error.</p>
33+
{/if}
34+
<p>Please try reloading the page.</p>
35+
<p>
36+
If the error persists, please drop by the
37+
<a href="/chat"> Discord chatroom </a>
38+
and let us know, or raise an issue on
39+
<a href="https://github.com/sveltejs/sites">GitHub</a>. Thanks!
40+
</p>
3241
{/if}
33-
<p>Please try reloading the page.</p>
34-
<p>
35-
If the error persists, please drop by the
36-
<a href="/chat"> Discord chatroom </a>
37-
and let us know, or raise an issue on
38-
<a href="https://github.com/sveltejs/sites">GitHub</a>. Thanks!
39-
</p>
42+
{:else}
43+
<h1>It looks like you're offline</h1>
44+
<p>Reload the page once you've found the internet.</p>
4045
{/if}
41-
{:else}
42-
<h1>It looks like you're offline</h1>
43-
<p>Reload the page once you've found the internet.</p>
44-
{/if}
46+
</div>
4547
</div>
4648

4749
<style>
48-
.container {
49-
padding: var(--sk-page-padding-top) var(--sk-page-padding-side) 6rem var(--sk-page-padding-side);
50+
.outer {
51+
display: flex;
52+
flex-direction: column;
53+
justify-content: center;
54+
align-items: center;
55+
padding: 0 var(--sk-page-padding-side) 6rem var(--sk-page-padding-side);
56+
width: 100%;
57+
height: 100%;
58+
}
59+
60+
.inner {
61+
max-width: 50rem;
62+
text-align: center;
63+
text-wrap: balance;
64+
65+
a {
66+
text-wrap: nowrap;
67+
}
5068
}
5169
5270
h1,

packages/site-kit/src/lib/styles/base.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ h1 {
8686
position: relative;
8787
font-family: var(--sk-font-heading);
8888
font-weight: 500;
89-
line-height: 1.35;
89+
line-height: 1.2;
9090
color: var(--sk-text-1);
9191
}
9292

0 commit comments

Comments
 (0)