Skip to content

Commit dc95bd3

Browse files
committed
handle fallback error
1 parent e6b6a68 commit dc95bd3

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
function throw_error() {
3+
throw new Error('throw_error');
4+
}
5+
</script>
6+
7+
{throw_error()}
8+
9+
<div>Foo</div>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
mode: ['client'],
5+
6+
test({ assert, logs }) {
7+
assert.deepEqual(logs, ['error caught 1', 'error caught 2']);
8+
}
9+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<script>
2+
import Child from "./Child.svelte";
3+
4+
function throw_error() {
5+
throw new Error('test')
6+
}
7+
</script>
8+
9+
<svelte:boundary onerror={(e) => console.log('error caught 2')}>
10+
<svelte:boundary onerror={(e) => console.log('error caught 1')}>
11+
<Child />
12+
13+
{#snippet failed()}
14+
{throw_error()}
15+
{/snippet}
16+
</svelte:boundary>
17+
</svelte:boundary>
18+
19+

0 commit comments

Comments
 (0)