class Makara::ErrorHandler

Public Instance Methods

handle(connection) { || ... } click to toggle source
# File lib/makara/error_handler.rb, line 7
def handle(connection)
  yield
rescue Exception => e
  if e.is_a?(Makara::Errors::MakaraError)
    harshly(e)
  else
    gracefully(connection, e)
  end
end

Protected Instance Methods

gracefully(connection, e) click to toggle source
# File lib/makara/error_handler.rb, line 19
def gracefully(connection, e)
  err = Makara::Errors::BlacklistConnection.new(connection, e)
  ::Makara::Logging::Logger.log("Gracefully handling: #{err}")
  raise err
end
harshly(e) click to toggle source
# File lib/makara/error_handler.rb, line 25
def harshly(e)
  ::Makara::Logging::Logger.log("Harshly handling: #{e}\n#{e.backtrace.join("\n\t")}")
  raise e
end