'Best practices for handling HTTP 404 responses in Rails using Turbo Frames?
I'm thinking through how Turbo Streams work, mostly as a thought experiment. I understand the basics after building a simple toy application. It's pretty powerful that so much can be done with a handful of Turbo Frames.
It's interesting to be able to respond with a Turbo Frame and the right content is replaced in the DOM. However, I've noticed that if a link within a Turbo Frame responds with HTTP 404, it only shows up in the error console. (Nothing changes on the visible page.) What's the best practice for handling errors like these? What's a simple option to give the user an indication that there's a broken link?
Solution 1:[1]
You could do a rescue_from method in the controller that catches that specific error then use turbo_streams to update the page with a nice little error message
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | yungindigo |
