This repository has been archived by the owner on Sep 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Error.svelte
61 lines (54 loc) · 2.27 KB
/
Error.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<script>
import MainLayout from 'layout/MainLayout.svelte';
import { getContext } from 'svelte';
const request = getContext('request');
const config = getContext('config');
export let statusCode;
export let error;
export let message;
const heds = {
404: 'error / not-found / hed',
403: 'error / forbidden / hed',
400: 'error / bad-request / hed'
};
const texts = {
404: 'error / not-found / text',
403: 'error / forbidden / text',
400: 'error / bad-request / text'
};
$: niceHed = __(heds[statusCode] || 'error / unexpected / hed');
$: niceText = __(texts[statusCode] || 'error / unexpected / text');
export let __;
</script>
<MainLayout title="Error {statusCode} / {error}">
<div class="container">
<div class="columns">
<div class="column is-four-fifths">
<h3 class="is-size-4 mb-2 has-text-grey">
Error {statusCode} ({error}{#if message !== error} / {message}{/if})
</h3>
<h1 class="title is-1 has-text-danger mt-1">{niceHed}</h1>
<p class="subtitle is-4">{niceText}</p>
<div class="content">
{#if statusCode === 404}
<p>Here are some other places you may want to go to now</p>
<ul>
<li><a href="/">Dashboard</a></li>
<li><a href="/account">User settings</a></li>
</ul>
{/if}
<p>
{@html __('error / support-help').replace(
'%s',
`mailto:[email protected]?subject=Error%20${statusCode}:%20${error}&body=%0A%0A%0A%0A----%0AError:%20${statusCode}%20/%20${message}%0AURL:%20${$request.method.toUpperCase()}%20${
$config.frontendDomain
}${$request.path}%0AQuery:%20${encodeURI(
JSON.stringify($request.query)
)}%0ATime:%20${new Date().toUTCString()}`
)}
</p>
</div>
</div>
</div>
</div>
</MainLayout>