Based on this, the approach how to enable error handling, has been documented officially at https://stimulus.hotwired.dev/handbook/installing#error-handling. It states, that it supports window.onerror, which is being used by most error handlers, like Sentry.
This meas, the current approach is not really necessary anymore.
https://www.betterstimulus.com/error_handling/global-error-handler states an approach how to enable global error handling.
In 2021, following improvements landed in Stimulus: https://github.com/hotwired/stimulus/pull/365
Based on this, the approach how to enable error handling, has been documented officially at https://stimulus.hotwired.dev/handbook/installing#error-handling. It states, that it supports
window.onerror
, which is being used by most error handlers, like Sentry.This meas, the current approach is not really necessary anymore.