Project

General

Profile

« Previous | Next » 

Revision fcc0d38b

Added by Ohad Levy over 12 years ago

  • ID fcc0d38bc89a9a3d6d372469bbc3a697e3b787f1

fixes #1149 - add backtrace to log failures

View differences:

lib/helpers.rb
# Accepts a html error code and a message, which is then returned to the caller after adding to the proxy log
# OR a block which is executed and its errors handled in a similar way.
# If no code is supplied when the block is declared then the html error used is 400.
def log_halt code=nil, message=nil
def log_halt code=nil, exception=nil
message = exception.is_a?(String) ? exception : exception.to_s
begin
if block_given?
return yield
......
end
content_type :json if request.accept.include?("application/json")
logger.error message
logger.debug exception.backtrace.join("\n") if exception.is_a?(Exception)
halt code, message
end
end

Also available in: Unified diff