We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When an error is thrown inside the {@const} tag, <svelte:boundary> doesn't catch it.
{@const}
<svelte:boundary>
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>
https://svelte.dev/playground/5bcbda8a665d489fa8d36977a7ebb551?version=5.20.2
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.2
annoyance
The text was updated successfully, but these errors were encountered:
Hello,
Note that the code is only present on dev mode, as it add an extra $.get(result)
dev
$.get(result)
Generated code :
const result = $.derived_safe_equal(fail); + $.get(result);
Source :
svelte/packages/svelte/src/compiler/phases/3-transform/client/visitors/ConstTag.js
Lines 30 to 34 in 3c4a8d4
I think I can fix that...
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Describe the bug
When an error is thrown inside the
{@const}
tag,<svelte:boundary>
doesn't catch it.This snippet works as expected:
However, this doesn't:
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.2
Severity
annoyance
The text was updated successfully, but these errors were encountered: