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-18/main.svelte

19 lines
316 B

<script>
let count = $state(0);
function maybe_throw() {
if (count > 1) {
throw new Error('test');
}
return count;
}
</script>
<svelte:boundary onerror={(e) => { throw(e) }}>
<div>Count: {count}</div>
<button onclick={() => count++}>Increment</button>
{count} / {maybe_throw()}
</svelte:boundary>