Skip to content

{#await} blocks without {:catch} should also trigger <svelte:boundary> #15803

New issue

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

Open
WaltzingPenguin opened this issue Apr 18, 2025 · 0 comments
Open

Comments

@WaltzingPenguin
Copy link

WaltzingPenguin commented Apr 18, 2025

Describe the problem

I have a <svelte:boundary> in my code for catching some potential issues. Inside of that is an {#await} that, since it hits the network, always has a chance to fail. I would like the display and handling of these two error conditions to be the same, but there's no good way to trigger the boundary when a promise fails.

Describe the proposed solution

I would like svelte:boundary to also catch errors in promises. Currently, this just renders blank:

<svelte:boundary>
  {#await Promise.reject()}
    Loading...
  {:then _}
     Loaded
   {/await}

  {#snippet failed()}
    An error has occurred
  {/snippet}
</svelte:boundary>

If there is a {:catch} on the block, that should not propagate up the boundary.

<svelte:boundary>
  {#await Promise.reject() then _}
    Loading...
  {:then _}
     Loaded
  {:catch}
     This error should be displayed
   {/await}

  {#snippet failed()}
    This error should not be shown
  {/snippet}
</svelte:boundary>

Importance

would make my life easier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant