Skip to content

Commit

Permalink
nicer error page
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Oct 2, 2024
1 parent 3006ee0 commit 2612adb
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 30 deletions.
76 changes: 47 additions & 29 deletions apps/svelte.dev/src/routes/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,59 @@
<title>{$page.status}</title>
</svelte:head>

<div class="container">
{#if online}
{#if $page.status === 404}
<h1>Not found!</h1>
<p>
If you were expecting to find something here, please drop by the
<a href="/chat"> Discord chatroom </a>
and let us know, or raise an issue on
<a href="https://github.com/sveltejs/sites">GitHub</a>. Thanks!
</p>
{:else}
<h1>Yikes!</h1>
<p>Something went wrong when we tried to render this page.</p>
{#if $page.error?.message}
<p class="error">{$page.status}: {$page.error.message}</p>
<div class="outer">
<div class="inner">
{#if online}
{#if $page.status === 404}
<h1>Not found!</h1>
<p>
If you were expecting to find something here, please drop by the
<a href="/chat"> Discord chatroom </a>
and let us know, or raise an issue on
<a href="https://github.com/sveltejs/sites">GitHub</a>. Thanks!
</p>
{:else}
<p class="error">Encountered a {$page.status} error.</p>
<h1>Yikes!</h1>
<p>Something went wrong when we tried to render this page.</p>
{#if $page.error?.message}
<p class="error">{$page.status}: {$page.error.message}</p>
{:else}
<p class="error">Encountered a {$page.status} error.</p>
{/if}
<p>Please try reloading the page.</p>
<p>
If the error persists, please drop by the
<a href="/chat"> Discord chatroom </a>
and let us know, or raise an issue on
<a href="https://github.com/sveltejs/sites">GitHub</a>. Thanks!
</p>
{/if}
<p>Please try reloading the page.</p>
<p>
If the error persists, please drop by the
<a href="/chat"> Discord chatroom </a>
and let us know, or raise an issue on
<a href="https://github.com/sveltejs/sites">GitHub</a>. Thanks!
</p>
{:else}
<h1>It looks like you're offline</h1>
<p>Reload the page once you've found the internet.</p>
{/if}
{:else}
<h1>It looks like you're offline</h1>
<p>Reload the page once you've found the internet.</p>
{/if}
</div>
</div>

<style>
.container {
padding: var(--sk-page-padding-top) var(--sk-page-padding-side) 6rem var(--sk-page-padding-side);
.outer {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 0 var(--sk-page-padding-side) 6rem var(--sk-page-padding-side);
width: 100%;
height: 100%;
}
.inner {
max-width: 50rem;
text-align: center;
text-wrap: balance;
a {
text-wrap: nowrap;
}
}
h1,
Expand Down
2 changes: 1 addition & 1 deletion packages/site-kit/src/lib/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ h1 {
position: relative;
font-family: var(--sk-font-heading);
font-weight: 500;
line-height: 1.35;
line-height: 1.2;
color: var(--sk-text-1);
}

Expand Down

0 comments on commit 2612adb

Please sign in to comment.