error.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div>
  3. <TopBanner>
  4. <template #headline><slot name="headline">{{ error.statusCode }}</slot></template>
  5. <template #tagline><slot name="tagline">means I f*cked up…</slot></template>
  6. </TopBanner>
  7. <div id="content_box" :class="`flex flex-col bg-white pt-12 sm:pt-24`">
  8. <CookieMonster />
  9. <MainMenu />
  10. <div class="container mx-auto max-w-screen-lg sm:px-12 px-2 prose">
  11. <article class="body grid grid-cols-1 gap-x-12 gap-y-0">
  12. <h3 class="text-5xl text-center -mt-6 sm:-mt-16">
  13. Sorry, I messed up.
  14. </h3>
  15. <p class="pt-12 py-6">Please copy the following error report and <a href="/contact" class="text-sky-500 underline">get in touch</a>.</p>
  16. <div>
  17. <span @click="copyToClipboard" class="btn btn-info btn-outline float-right">Copy to clipboard</span>
  18. <div id="errorReport">
  19. <p>Error code: {{ error.statusCode }}</p>
  20. <p>Message: {{ error.message }}</p>
  21. <p>URL: {{ error.url }}</p>
  22. <p v-if="error.data">Additional data: {{ error.data }}</p>
  23. <div v-html="error.description" />
  24. </div>
  25. </div>
  26. <p>&nbsp;</p><p>&nbsp;</p>
  27. </article>
  28. </div>
  29. </div>
  30. <Footer />
  31. </div>
  32. </template>
  33. <style lang="pcss">
  34. article.body h2 {
  35. @apply mt-0;
  36. }
  37. </style>
  38. <script setup>
  39. const props = defineProps({
  40. error: Object
  41. })
  42. const copyToClipboard = () => {
  43. navigator.permissions.query({ name: 'clipboard-write' }).then(result => {
  44. if (result.state === 'granted' || result.state === 'prompt') {
  45. const element = document.getElementById('errorReport');
  46. navigator.clipboard.writeText(element.innerText).then(() => {
  47. alert("Error report copied. Head over to the contact section and get in touch!");
  48. });
  49. }
  50. });
  51. }
  52. </script>