|
| 1 | +<script lang="ts"> |
| 2 | + interface ErrorTest { |
| 3 | + title: string; |
| 4 | + description: string; |
| 5 | + href: string; |
| 6 | + category: string; |
| 7 | + } |
| 8 | +
|
| 9 | + const errorTests: ErrorTest[] = [ |
| 10 | + // Window Error Handlers |
| 11 | + { |
| 12 | + title: 'Synchronous Runtime Error', |
| 13 | + description: 'Error thrown in event handler', |
| 14 | + href: '/errors/runtime-error', |
| 15 | + category: 'Global Error Handlers (🔴)' |
| 16 | + }, |
| 17 | + { |
| 18 | + title: 'Unhandled Promise Rejection', |
| 19 | + description: 'Promise rejected without catch handler', |
| 20 | + href: '/errors/promise-rejection', |
| 21 | + category: 'Global Error Handlers (🔴)' |
| 22 | + }, |
| 23 | + ]; |
| 24 | +
|
| 25 | + const categories = Array.from(new Set(errorTests.map(t => t.category))); |
| 26 | +</script> |
| 27 | + |
1 | 28 | <svelte:head> |
2 | 29 | <title>Hawk Javascript SvelteKit Integration Playground</title> |
3 | 30 | </svelte:head> |
| 31 | + |
| 32 | +<div class="container"> |
| 33 | + <header> |
| 34 | + <h1>🧪 SvelteKit Error Handling Test Suite</h1> |
| 35 | + </header> |
| 36 | + |
| 37 | + <div class="alert alert-warning"> |
| 38 | + <strong>⚠️ Testing Instructions:</strong> |
| 39 | + <ul> |
| 40 | + <li>Open your browser's DevTools Console to see error logs</li> |
| 41 | + <li>Look for colored emoji markers: |
| 42 | + <ul> |
| 43 | + <li>🔴 = Caught by global <code>window.error</code> or <code>window.unhandledrejection</code></li> |
| 44 | + </ul> |
| 45 | + </li> |
| 46 | + <li>Each test demonstrates where errors are caught in the SvelteKit error handling hierarchy</li> |
| 47 | + </ul> |
| 48 | + </div> |
| 49 | + |
| 50 | + {#each categories as category} |
| 51 | + <section> |
| 52 | + <h2>{category}</h2> |
| 53 | + <div class="grid"> |
| 54 | + {#each errorTests.filter(t => t.category === category) as test} |
| 55 | + <a href={test.href} class="test-card" data-sveltekit-preload-data="off"> |
| 56 | + <h3>{test.title}</h3> |
| 57 | + <p>{test.description}</p> |
| 58 | + </a> |
| 59 | + {/each} |
| 60 | + </div> |
| 61 | + </section> |
| 62 | + {/each} |
| 63 | +</div> |
0 commit comments