hotwired / stimulus-rails

Use Stimulus in your Ruby on Rails app
https://stimulus.hotwired.dev
MIT License
637 stars 91 forks source link

Failing to register controllers does not bubble the error to handleError #102

Closed crohr closed 2 months ago

crohr commented 2 years ago

Whenever a controller fails to register (for instance if a targetNameConnected() method throws an error), stimulus will catch the error and display a console message. However that means we can never be alerted of that error, because it doesn't bubble the error to application.handleError, which I believe is the hook point to setup exception monitoring (appsignal, etc.)

Is it by design, or are you open to a fix?

https://github.com/hotwired/stimulus-rails/blob/7e0150bc2f30f8443c8bfdbfdd508c2eea4427e7/app/assets/javascripts/stimulus-loading.js#L27

dhh commented 2 years ago

Not by design. Would be good with a fix 👍

stefannibrasil commented 2 months ago

Hi! I ran into this issue recently and opened a PR to fix this 🤞🏼

crohr commented 2 months ago

Thanks @stefannibrasil, totally forgot to upstream the fix. Glad to see it merged!