You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/packages/svelte/tests/runtime-runes/samples/error-boundary-12/main.svelte

21 lines
297 B

<script>
let count = $state(0);
const d = $derived.by(() => {
if (count === 1) {
throw new Error('kaboom')
}
return count
})
</script>
<button onclick={() => count++}>change</button>
<svelte:boundary>
{d}
{#snippet failed()}
<p>Error occured</p>
{/snippet}
</svelte:boundary>