Method: Deas::ErrorHandler#run

Defined in:
lib/deas/error_handler.rb

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/deas/error_handler.rb', line 16

def run
  response = nil
  @error_procs.each do |error_proc|
    begin
      result = @sinatra_call.instance_exec(@exception, &error_proc)
      response = result if result
    rescue Exception => proc_exception
      @exception = proc_exception
      # reset the response if an exception occurs while evaulating the
      # error procs -- a new exception will now be handled by the
      # remaining procs
      response = nil
    end
  end
  response
end