Class: HandleErrors

Inherits:
Dandy::HandleErrors show all
Defined in:
lib/dandy/generators/templates/actions/common/handle_errors.rb

Instance Method Summary collapse

Methods inherited from Dandy::HandleErrors

#initialize

Constructor Details

This class inherits a constructor from Dandy::HandleErrors

Instance Method Details

#callObject



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.message
  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