All files / apps/portfolio/app error.vue

93.75% Statements 15/16
83.33% Branches 5/6
75% Functions 3/4
93.75% Lines 15/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 75 76 77 78 79 80 81  8x             7x     7x     7x 7x                     8x             7x     7x     7x 7x         1x                     8x                         8x 8x   8x                
<template>
    <UApp>
        <NuxtLayout>
            <section
                v-if="error.status === 404"
                data-error="not-found"
                class="mx-auto flex max-w-6xl flex-col gap-6 px-4 pt-10 pb-20 md:px-10 md:pt-20"
            >
                <p class="font-mono text-xs text-muted uppercase">
                    {{ $t("error.kicker", { status: error.status }) }}
                </p>
                <h1 class="font-display text-title text-highlighted md:text-statement">
                    {{ $t("error.notFound.title") }}
                </h1>
                <p class="max-w-xl text-lg text-muted">{{ $t("error.notFound.lead") }}</p>
                <div class="flex flex-col gap-3 sm:flex-row">
                    <UButton to="/" :label="$t('error.notFound.home')" class="justify-center" />
                    <UButton
                        :to="portal"
                        variant="outline"
                        color="neutral"
                        trailing-icon="i-lucide-arrow-right"
                        :label="$t('error.notFound.developer')"
                        class="justify-center"
                    />
                </div>
            </section>
 
            <section
                v-else
                data-error="server"
                class="mx-auto flex max-w-6xl flex-col gap-6 px-4 pt-10 pb-20 md:px-10 md:pt-20"
            >
                <p class="font-mono text-xs text-muted uppercase">
                    {{ $t("error.kicker", { status: error.status }) }}
                </p>
                <h1 class="font-display text-title text-highlighted">
                    {{ $t("error.server.title") }}
                </h1>
                <p class="max-w-xl text-lg text-muted">{{ $t("error.server.lead") }}</p>
                <div class="flex flex-col gap-3 sm:flex-row">
                    <UButton
                        icon="i-lucide-rotate-cw"
                        :label="$t('error.server.retry')"
                        class="justify-center"
                        @click="reloadNuxtApp({ force: true })"
                    />
                    <UButton
                        to="/"
                        variant="outline"
                        color="neutral"
                        :label="$t('error.server.home')"
                        class="justify-center"
                    />
                </div>
            </section>
        </NuxtLayout>
    </UApp>
</template>
 
<script lang="ts" setup>
import type { NuxtError } from "#app";
 
interface Props {
    error: NuxtError;
}
 
const { error } = defineProps<Props>();
 
const { t } = useI18n();
const portal = portalUrl("/");
 
useHead(
    {
        title: () => t("error.head", { status: error.status }),
        meta: [{ name: "robots", content: "noindex" }],
    },
    { tagPriority: "high" },
);
</script>