On Jun 23, 2014, at 9:48 AM, Yuki Nishijima <m...@yukinishijima.net> wrote:

> When building dynamic error pages, people (specially beginners) always write 
> rescue_from(Exception, ...) in ApplicationController. You can see it (or 
> something similar) is suggested on Stackoverflow and even RailsCasts.

The RailsCasts example is framed as “you really shouldn’t do this” with 
explanatory text as to *why* it’s a bad thing to do.

The StackOverflow example is explicitly attempting to construct a general 
exception notifier - a *replacement* for exception_notification and airbrake.

> However, doing so has serious side-effects such as listed below because it 
> halts the error chain:
> 
>   * No longer able to see nice exception details during development
>   * gems like exception_notification and airbrake stops working
> 
> In addition, I've never seen any good use-cases of it in controllers. So I 
> think it only gives us serious issues.
> 
> And here's what I propose:
> 
>   * ActiveSupport::Rescuable remains the same
>   * ActionController::Rescue overrides rescue_from and change it to not 
> accept Exception(raise some exception or output warning)

Rescuing `Exception` is not the best practice, but there are reasons that 
somebody might want to do it. We can’t save people from doing 
silly-but-potentially-valid things.

—Matt Jones

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to