Module: Pakyow::Routing::Behavior::ErrorHandling
- Extended by:
- Support::Extension
- Included in:
- Controller
- Defined in:
- lib/pakyow/routing/controller/behavior/error_handling.rb
Defined Under Namespace
Modules: API
Instance Method Summary collapse
- #handle_error(error) ⇒ Object
-
#trigger(name_or_code) ⇒ Object
Calls the handler for a particular http status code.
Instance Method Details
#handle_error(error) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/pakyow/routing/controller/behavior/error_handling.rb', line 42 def handle_error(error) connection.error = error connection.status = 500 catch :halt do call_handlers_with_args( exceptions_for_class(error.class) || handlers_for_code(500), error ) end halt end |
#trigger(name_or_code) ⇒ Object
Calls the handler for a particular http status code.
36 37 38 39 40 |
# File 'lib/pakyow/routing/controller/behavior/error_handling.rb', line 36 def trigger(name_or_code) code = Connection::Statuses.code(name_or_code) connection.status = code trigger_for_code(code) end |