_error.svelte 674 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <script lang="typescript">
  2. export let status: string;
  3. export let error: Error;
  4. // @ts-ignore -- creates a warning when the left side of the === is replaced with "production" by rollup-plugin-replace in `rollup.config.js`
  5. const dev = process.env.NODE_ENV === "development";
  6. </script>
  7. <style>
  8. section {
  9. flex: 1 1 0%;
  10. display: flex;
  11. flex-direction: column;
  12. align-items: center;
  13. justify-content: center;
  14. }
  15. h1, h2 {
  16. color: #C53030;
  17. }
  18. h1 {
  19. margin-top: 0.25rem;
  20. font-size: 1.5rem;
  21. }
  22. h2 {
  23. font-size: 1.125rem;
  24. }
  25. </style>
  26. <section>
  27. <h1>{error.message}</h1>
  28. <h2>{status}</h2>
  29. </section>
  30. {#if dev && error.stack}
  31. <pre>{error.stack}</pre>
  32. {/if}