-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
error.vue
48 lines (43 loc) · 1.1 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
<script setup lang="ts">
const props = defineProps<{
error: unknown
}>()
useHead({
bodyAttrs: {
class: 'bg-black antialiased min-h-screen text-white'
},
})
const statusCode = computed(() => {
if(typeof props.error !== 'object' || props.error === null) {
return 500
}
if('statusCode' in props.error) {
return props.error.statusCode
}
return 500
})
const message = computed(() => {
if(typeof props.error !== 'object' || props.error === null) {
return 'Unknown error'
}
if('statusMessage' in props.error) {
return props.error.statusMessage
}
if('message' in props.error) {
return props.error.message
}
return 'Unknown error'
})
</script>
<template>
<div>
<AppNavbar />
<AppSection class="mt-8 prose md:prose-lg lg:prose-xl">
<ParagraphDecoration />
<AppParagraph look="heading" class="mt-4" tag="h1">Error {{ statusCode }}</AppParagraph>
<AppParagraph look="subParagraph" tag="p"> {{ message }}</AppParagraph>
<AppLink to="/" class="mt-16">Go back to the home page</AppLink>
</AppSection>
<AppFooter />
</div>
</template>