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