good error

This commit is contained in:
Jill 2022-05-03 23:50:22 +03:00
parent 3caa4766a4
commit d0220de8ee
2 changed files with 83 additions and 28 deletions

56
src/routes/__error.svelte Normal file
View File

@ -0,0 +1,56 @@
<script context="module">
/** @type {import('@sveltejs/kit').Load} */
export function load({ error, status }) {
return {
props: {
status: status,
message: error.message,
stack: error.stack
}
};
}
</script>
<script>
export let status;
export let message;
export let stack;
</script>
<style>
.gradient {
font-size: 100px;
line-height: 0.1;
background: repeating-linear-gradient(98deg, rgba(190,190,190,1) 0%, rgba(190,190,190,1) 10%, rgba(207,207,207,1) 10%, rgba(207,207,207,1) 20%);
background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: bolder;
}
h1 {
margin-bottom: 0.5em;
}
.error {
display: flex;
flex-direction: column;
align-items: center;
max-width: 800px;
}
pre {
max-width: 100%;
overflow-x: auto;
background-color: #222;
color: #fff;
padding: 1em;
border-radius: 1em;
}
</style>
<div class="error">
<div class="gradient">
<h1>{status}</h1>
</div>
{message}
{#if stack}
<pre>{stack}</pre>
{/if}
</div>

View File

@ -54,31 +54,30 @@
color: #fff;
}
}
</style>
<svelte:head>
<title>{page.name} - Guidebook</title>
<meta name="description" content="{page.description || 'A Guidebook guide!'}" />
</svelte:head>
<div class="stuff">
<div class="side">
<nav>
<el>
{#each extractAnchors(page.content) as anchor}
{#if anchor.level === 2}
<li style="margin-left: {Math.max(anchor.level - 2, 0) * 0.3}em">
<a href="#{toAnchor(anchor.name)}">
{anchor.name}
</a>
</li>
{/if}
{/each}
</el>
</nav>
</div>
<content>
<Page content={page.content}></Page>
</content>
</div>
</style>
<svelte:head>
<title>{page.name} - Guidebook</title>
<meta name="description" content="{page.description || 'A Guidebook guide!'}" />
</svelte:head>
<div class="stuff">
<div class="side">
<nav>
<el>
{#each extractAnchors(page.content) as anchor}
{#if anchor.level === 2}
<li style="margin-left: {Math.max(anchor.level - 2, 0) * 0.3}em">
<a href="#{toAnchor(anchor.name)}">
{anchor.name}
</a>
</li>
{/if}
{/each}
</el>
</nav>
</div>
<content>
<Page content={page.content}></Page>
</content>
</div>