class Redbreast::ErrorHandler

Class for handling errors that occurr

Public Class Methods

handle(error) click to toggle source
# File lib/redbreast/error_handler.rb, line 13
def handle(error)
  prompt.error(
    case error
    when Errno::ENOENT
      "We could not find a file that we need:\n\n#{error.message}"
    else
      "An error happened. This might help:\n\n#{error.message}"
    end
  )
end
rescuable() { || ... } click to toggle source
# File lib/redbreast/error_handler.rb, line 7
def rescuable
  yield
rescue StandardError => e
  handle(e)
end