mirror of https://github.com/sveltejs/svelte
parent
7d72187fed
commit
34c2900a64
@ -1,7 +1,14 @@
|
|||||||
<script>
|
<script>
|
||||||
const { things } = $props();
|
const { count } = $props();
|
||||||
|
|
||||||
|
const d = $derived.by(() => {
|
||||||
|
if (count === 1) {
|
||||||
|
throw new Error('kaboom')
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
});
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
things
|
d;
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
let count = $state(0);
|
let count = $state(0);
|
||||||
|
|
||||||
let test = $derived.by(() => {
|
function maybe_throw() {
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
throw new Error('test');
|
throw new Error('test');
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:boundary onerror={(e) => { throw(e) }}>
|
<svelte:boundary onerror={(e) => { throw(e) }}>
|
||||||
<div>Count: {count}</div>
|
<div>Count: {count}</div>
|
||||||
<button onclick={() => count++}>Increment</button>
|
<button onclick={() => count++}>Increment</button>
|
||||||
{count} / {test}
|
{count} / {maybe_throw()}
|
||||||
</svelte:boundary>
|
</svelte:boundary>
|
||||||
|
|
||||||
|
Loading…
Reference in new issue