-
Notifications
You must be signed in to change notification settings - Fork 4
/
error.vue
74 lines (71 loc) · 2.59 KB
/
error.vue
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
62
63
64
65
66
67
68
69
70
71
72
73
74
<template>
<div>
<div class="error__wrapper">
<div class="error__image" />
<div class="error">
<div v-if="maintenance" class="maintenance__container px-3 bg-white">
<h1 class="mt-4">Sorry - we're doing some maintenance</h1>
<p>
We're doing some maintenance work just now - one on't cross beams
gone owt askew on treadle, the dilithium crystals need polishing,
the server pie has a soggy bottom, that kind of thing.
</p>
<p>
Usually this doesn't take more than an hour or two. Please
<nuxt-link no-prefetch to="/">try again</nuxt-link>
later.
</p>
<p>
P.S. We know this is a bit of a pain, and we try really hard to
avoid taking the whole site down where we can. Very occasionally we
need to do it. If you want to
<ExternalLink
href="https://www.paypal.com/gb/fundraiser/charity/55681"
>donate a quid</ExternalLink
>, that'll help it happen less often.
</p>
</div>
<div v-else>
<h1 v-if="error?.statusCode === 404">
<div class="error__heading--main">
Oh no! That page doesn't seem to exist...
</div>
<div class="error__heading--sub">Maybe it's been freegled?</div>
</h1>
<div v-else>
<h1 class="error__heading--main">
Oh dear! Something went wrong...
</h1>
<p v-if="error && JSON.stringify(error).length > 2">
Error was: {{ JSON.stringify(error) }}
</p>
</div>
<p>
<nuxt-link no-prefetch to="/">Click here</nuxt-link> to go back to
the home page
</p>
<p>
<!-- eslint-disable-next-line -->
Having problems? <SupportLink text="Contact us" />
</p>
</div>
</div>
</div>
</div>
</template>
<script setup>
import SupportLink from '~/components/SupportLink'
import ExternalLink from '~/components/ExternalLink'
import { useError } from '#imports'
const error = useError()
const maintenance = error?.value?.message === 'Maintenance error'
const importError =
error?.value?.message.includes(
'Failed to fetch dynamically imported module'
) || error?.value?.message.includes('Importing a module script failed')
if (importError) {
// This can happen when a page load is cancelled by the user, sometimes. Reload.
console.log('Import of module error - reload')
window.location.reload()
}
</script>