Diving in Rails - Exceptions handling
Warning : This article was written a while ago, my views may have changed and this may not be relevant anymore.
Ruby code, just like any other code, can be subject to failure.
Fortunately, when an error occurs inside your Rails application, your rails server does not crash and stop serving requests.
In this article, I’ll explain how rails catches exceptions that may happen in your code, and how it renders a nice error page, depending on the Rails environment, and how you can customise it.
I won’t be talking about rescue_from
, and ActionController::Rescue
, but about the rack part.
Remember, it’s all Rack !
If you read my previous article about [Rails request handling](blog.siami.fr/diving-in-rails-the-request-handling), you know that Rails is based on Rack, and uses middlewares for various things.
Rails also handles exceptions with middlewares.
This article will explain how...