Skip to content

Handle errors in value and target callbacks - #916

Open
00200200 wants to merge 1 commit into
hotwired:mainfrom
00200200:fix/handle-errors-in-value-and-target-callbacks
Open

00200200 wants to merge 1 commit into
hotwired:mainfrom
00200200:fix/handle-errors-in-value-and-target-callbacks

Conversation

@00200200

@00200200 00200200 commented Oct 5, 2026

Copy link
Copy Markdown

Summary

  • Wrap Context#invokeControllerMethod so target/outlet lifecycle callbacks report via handleError instead of escaping uncaught.
  • Route *ValueChanged exceptions through handleError (keeping the existing TypeError message enrichment).
  • Add regression tests mirroring the existing connect error-handler coverage.

Fixes #711

Test plan

  • yarn build:test && yarn karma start karma.conf.cjs --browsers=ChromeHeadless (219 SUCCESS)
  • Verify a controller that throws in fooValueChanged / itemTargetConnected logs via Stimulus error handling and still allows the rest of the app to continue

Route exceptions from *ValueChanged and *TargetConnected/Disconnected
(and outlet callbacks) through Application#handleError so they match the
documented connect/disconnect/action behavior.

Fixes hotwired#711
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Errors are not caught/handled within value changed & target connected callbacks

1 participant