Class: Startback::Web::CatchAll
- Inherits:
-
Rack::Robustness
- Object
- Rack::Robustness
- Startback::Web::CatchAll
- Includes:
- Errors, Support::Robustness
- Defined in:
- lib/startback/web/catch_all.rb
Overview
This Rack middleware catches all exceptions that are raised by sublayers in the Rack chain. It converts them to correct 500 Errors, with a generic exception message encoded in json.
This class aims at being used as top level of a Rack chain. It is not aimed at being subclassed.
Fatal error cached are also sent as a ‘fatal` messange, on the error handler provided on Context#error_handler.fatal, if any.
Examples:
Rack::Builder.new do
use Startback::Web::CatchAll
end
Constant Summary collapse
- FATAL_ERROR =
{ code: "Startback::Errors::InternalServerError", description: "An error occured, sorry" }.to_json
Method Summary
Methods included from Support::Robustness
#log, #monitor, #stop_errors, #try_max_times
Methods included from Errors
bad_request_error!, conflict_error!, expectation_failed_error!, forbidden_error!, gone_error!, internal_server_error!, locked_error!, method_not_allowed_error!, not_acceptable_error!, not_found_error!, not_implemented_error!, precondition_failed_error!, precondition_required_error!, server_error!, unauthorized_error!, unsupported_media_type_error!, user_error!