mirror of https://github.com/sveltejs/svelte
Merge 602b885bc6
into b92a55994b
commit
5c68c7a6c7
@ -0,0 +1,14 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
test({ assert, target, logs }) {
|
||||
let btn = target.querySelector('button');
|
||||
|
||||
btn?.click();
|
||||
btn?.click();
|
||||
flushSync();
|
||||
|
||||
assert.deepEqual(logs, ['error caught 1', 'error caught 2']);
|
||||
}
|
||||
});
|
@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
import Test from './test.svelte';
|
||||
</script>
|
||||
|
||||
<svelte:boundary onerror={(e) => {console.log('error caught root')}}>
|
||||
<Test />
|
||||
</svelte:boundary>
|
@ -0,0 +1,15 @@
|
||||
<script>
|
||||
let count = $state(0);
|
||||
|
||||
let test = $derived.by(() => {
|
||||
if (count > 1) {
|
||||
throw new Error('test');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:boundary onerror={(e) => {console.log('error caught 1')}}>
|
||||
<div>Count: {count}</div>
|
||||
<button onclick={() => count++}>Increment</button>
|
||||
{count} / {test}
|
||||
</svelte:boundary>
|
Loading…
Reference in new issue