Skip to content

Commit 2ab7007

Browse files
authored
slightly nicer error page (sveltejs#69)
1 parent 740e721 commit 2ab7007

File tree

7 files changed

+126
-22
lines changed

7 files changed

+126
-22
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<script>
2+
import { page } from '$app/stores';
3+
</script>
4+
5+
{#if $page.status === 404}
6+
<h1>Not found</h1>
7+
<p><a href="/">Go to /</a></p>
8+
{:else}
9+
<p>
10+
Server-side rendering failed with HTTP status
11+
code
12+
<a
13+
target="_blank"
14+
href="https://httpstatusdogs.com/{$page.status}"
15+
>{$page.status}</a
16+
>
17+
</p>
18+
19+
<pre>{$page.error?.stack || ''}</pre>
20+
{/if}
21+
22+
<style>
23+
h1 {
24+
font-weight: 200;
25+
font-size: 2rem;
26+
margin: 0 0 0.5em 0;
27+
}
28+
29+
pre {
30+
font-family: Menlo, Monaco, monospace;
31+
font-size: 13px;
32+
background: hsl(0, 100%, 95%);
33+
padding: 1rem;
34+
overflow-x: auto;
35+
border-radius: 5px;
36+
color: hsl(0, 100%, 30%);
37+
}
38+
</style>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<main>
2+
<slot />
3+
</main>
4+
5+
<style>
6+
:global(body) {
7+
font-family: -apple-system, BlinkMacSystemFont,
8+
'Segoe UI', Roboto, Oxygen, Ubuntu,
9+
Cantarell, 'Open Sans', 'Helvetica Neue',
10+
sans-serif;
11+
margin: 0;
12+
}
13+
14+
main {
15+
width: 100%;
16+
height: 100vh;
17+
box-sizing: border-box;
18+
padding: 8px;
19+
}
20+
</style>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script>
2+
import App from '$lib/App.svelte';
3+
</script>
4+
5+
<App />
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<script>
2+
import { page } from '$app/stores';
3+
</script>
4+
5+
{#if $page.status === 404}
6+
<h1>Not found</h1>
7+
<p><a href="/">Go to /</a></p>
8+
{:else}
9+
<p>
10+
Server-side rendering failed with HTTP status
11+
code
12+
<a
13+
target="_blank"
14+
href="https://httpstatusdogs.com/{$page.status}"
15+
>{$page.status}</a
16+
>
17+
</p>
18+
19+
<pre>{$page.error?.stack || ''}</pre>
20+
{/if}
21+
22+
<style>
23+
h1 {
24+
font-weight: 200;
25+
font-size: 2rem;
26+
margin: 0 0 0.5em 0;
27+
}
28+
29+
pre {
30+
font-family: Menlo, Monaco, monospace;
31+
font-size: 13px;
32+
background: hsl(0, 100%, 95%);
33+
padding: 1rem;
34+
overflow-x: auto;
35+
border-radius: 5px;
36+
color: hsl(0, 100%, 30%);
37+
}
38+
</style>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<main>
2+
<slot />
3+
</main>
4+
5+
<style>
6+
:global(body) {
7+
font-family: -apple-system, BlinkMacSystemFont,
8+
'Segoe UI', Roboto, Oxygen, Ubuntu,
9+
Cantarell, 'Open Sans', 'Helvetica Neue',
10+
sans-serif;
11+
margin: 0;
12+
}
13+
14+
main {
15+
width: 100%;
16+
height: 100vh;
17+
box-sizing: border-box;
18+
padding: 8px;
19+
}
20+
</style>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script>
2+
import App from '$lib/App.svelte';
3+
</script>
4+
5+
<App />

content/tutorial/common/src/routes/index.svelte

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)