Method: Hanami::Config#render_error_responses

Defined in:
lib/hanami/config.rb

#render_error_responsesHash{String => Symbol}

Sets a mapping of exception class names (as strings) to symbolic response status codes used for rendering error responses.

The response status codes will be passed to ‘Rack::Utils.status_code`.

In ordinary usage, you should not replace this hash. Instead, add keys and values for the errors you want handled.

Examples:

config.render_error_responses
# => {"Hanami::Router::NotFoundError" => :not_found}

config.render_error_responses["MyNotFoundError"] = :not_found

Returns:

  • (Hash{String => Symbol})

See Also:

Since:

  • 2.1.0

[View source]

182
183
184
185
# File 'lib/hanami/config.rb', line 182

setting :render_error_responses, default: Hash.new(:internal_server_error).merge!(
  "Hanami::Router::NotAllowedError" => :not_found,
  "Hanami::Router::NotFoundError" => :not_found,
)