Class: HandleErrors
- Inherits:
-
Dandy::HandleErrors
- Object
- Dandy::HandleErrors
- HandleErrors
- Defined in:
- lib/dandy/generators/templates/actions/common/handle_errors.rb,
lib/dandy/generators/templates/actions/common/handle_errors_jet_set.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(container, dandy_error, sequel) ⇒ HandleErrors
constructor
A new instance of HandleErrors.
Constructor Details
#initialize(container, dandy_error, sequel) ⇒ HandleErrors
2 3 4 5 6 |
# File 'lib/dandy/generators/templates/actions/common/handle_errors_jet_set.rb', line 2 def initialize(container, dandy_error, sequel) super(container, dandy_error) @sequel = sequel end |
Instance Method Details
#call ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/dandy/generators/templates/actions/common/handle_errors.rb', line 2 def call # implement your own error handling logic here. # by default let's print the error to standard output puts @dandy_error. puts @dandy_error.backtrace # use preferred HTTP status code for different cases # i.e. set_http_status(403) for authorization issue set_http_status(500) end |