Method: Hanami::Controller::Configuration#handle_exceptions

Defined in:
lib/hanami/controller/configuration.rb

#handle_exceptions(value) ⇒ Object #handle_exceptionsTrueClass, FalseClass

Handle exceptions with an HTTP status or let them uncaught

If this value is set to `true`, the configured exceptions will return the specified HTTP status, the rest of them with `500`.

If this value is set to `false`, the exceptions won't be caught.

This is part of a DSL, for this reason when this method is called with an argument, it will set the corresponding instance variable. When called without, it will return the already set value, or the default.

Examples:

Getting the value

require 'hanami/controller'

Hanami::Controller.configuration.handle_exceptions # => true

Setting the value

require 'hanami/controller'

Hanami::Controller.configure do
  handle_exceptions false
end

Overloads:

  • #handle_exceptions(value) ⇒ Object

    Sets the given value

    Parameters:

    • value (TrueClass, FalseClass)

      true or false, default to true

  • #handle_exceptionsTrueClass, FalseClass

    Gets the value

    Returns:

    • (TrueClass, FalseClass)

See Also:

Since:

  • 0.2.0


161
162
163
164
165
166
167
# File 'lib/hanami/controller/configuration.rb', line 161

def handle_exceptions(value = nil)
  if value.nil?
    @handle_exceptions
  else
    @handle_exceptions = value
  end
end