Diving in Rails - Exceptions handling
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
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 exceptions are handled in a production environment. If you are interested in understanding how Rails displays errors
Continue reading →