I've had a lot of fun playing around with the still-beta Phoenix LiveView library. One thing that I'm confused about is how to ensure that my LiveViews will behave in a predictable and transparent way when an exception occurs.
In a conventional HTTP-request-based world, I'd expect that particular request to crash, returning a 500 response and possibly some error page that indicates to the user "Hey, there's a problem with the server". And the developer can count on integrations such as Rollbax detecting and reporting on the exception, so I get an email about the error and can inspect it in the Rollbar dashboard.
But when my LiveView code crashes, I don't get this assurance. The LiveView process will recover from the crash and (as I understand it) revert to its last known healthy state, which is really cool but also could invite user frustration (e.g. "Every time I submit your form, it shows me a loading icon then reverts to the blank form"). And I'm unclear how I could detect or catch exceptions in my LiveView so that they can be reported to an error monitoring service like Rollbar. (Short of impractical solutions like adding a rescue
to every handler)
How can I detect exceptions that happen in a LiveView so that I can a) somehow alert the end user of the problem, and b) ensure the exception is reported to the developer?