Class: HandleErrors

Inherits:
Dandy::HandleErrors show all
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

Constructor Details

#initialize(container, dandy_error, sequel) ⇒ HandleErrors

Returns a new instance of 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

#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