-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the bug
When an error is thrown inside the {@const} tag, <svelte:boundary> doesn't catch it.
This snippet works as expected:
<script>
function fail() {
throw new Error('π£');
}
</script>
<h1>Hello!</h1>
<svelte:boundary>
<span>{fail()}</span>
{#snippet failed()}
<p>Somethning went wrong :(</p>
{/snippet}
</svelte:boundary>However, this doesn't:
<script>
function fail() {
throw new Error('π£');
}
</script>
<h1>Hello!</h1>
<svelte:boundary>
{@const result = fail()}
<span>{result}</span>
{#snippet failed()}
<p>Somethning went wrong :(</p>
{/snippet}
</svelte:boundary>Reproduction
https://svelte.dev/playground/5bcbda8a665d489fa8d36977a7ebb551?version=5.20.2
Logs
System Info
System:
OS: macOS 15.3.1
CPU: (10) arm64 Apple M2 Pro
Memory: 264.11 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.15.1 - /opt/homebrew/bin/node
npm: 10.7.0 - /opt/homebrew/bin/npm
pnpm: 8.15.4 - /opt/homebrew/bin/pnpm
bun: 1.1.18 - /opt/homebrew/bin/bun
Browsers:
Brave Browser: 131.1.73.91
Safari: 18.3
npmPackages:
svelte: ^5.20.2 => 5.20.2Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels