Skip to content

Unable to handle bound getter/setter errors #14892

@colecrouter

Description

@colecrouter

Describe the bug

I noticed when you throw an error via a setter, then bind an input to it, that error is not treated as a UI/rendering/effect error; using +error.svelte or <svelte:boundary> to try and catch the error does not result in anything happening. Instead, the error is logged to the console as "uncaught", and everything continues like nothing went wrong.

—except it doesn't; some related event handlers/effects silently fail.

While I can appreciate that a getter/setter error isn't strictly UI/rendering/effect related, leaving the app in a half-working/UB state is a poor solution.

Is there another pattern for an issue like this? What ought someone do to handle these errors gracefully?

Reproduction

https://svelte.dev/playground/88805747a51c4ae981d01fff06573370?version=5.16.1

Enter a number into the box, notice how the UI updates + the side effect in the console.

Now delete the number. The error should appear in the console. Subsequent inputs will reflect in the UI, but notice how the "side effect" no longer runs (until the page is reloaded).

Lastly, none of this is caught by the <svelte:boundary>.

Logs

No response

System Info

System:
  OS: Windows 11 10.0.26100
  CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700K
  Memory: 6.27 GB / 15.79 GB
Binaries:
  Node: 22.9.0 - C:\Program Files\nodejs\node.EXE
  Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
  npm: 10.8.3 - C:\Program Files\nodejs\npm.CMD
Browsers:
  Edge: Chromium (130.0.2849.46)
  Internet Explorer: 11.0.26100.1882
npmPackages:
  svelte: ^5.16.1 => 5.16.1

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions