Closed stefannibrasil closed 2 months ago
Excellent fix! Like how it also prevents swallowing of any exceptions that might not be TypeErrors.
Yes, I'd be happy for us to explore a test suite for this stuff. If we can find a way to do it that isn't overly complicated!
Thank you for the feedback! I will explore some approaches for JS testing when I am back from RailsWorld 🎉
Fixes https://github.com/hotwired/stimulus-rails/issues/102
When failing to register a controller, Stimulus catches the error and logs a console message. But that means the error won't be logged in a monitoring tool, making it hard to identify the issue.
This change follows the pattern in other files to catch this Type Error, format an error message, and re-throw the error so it can be tracked by monitoring tools.
This is my first contribution to Stimulus, so please let me know what I am missing. Thanks for reviewing it!
Before
After
PS. I noticed we don't have unit JS tests. Would setting something up for unit tests be a helpful future contribution?