class Deploy::ErrorHandler

Constants

ERROR_MESSAGES

Public Class Methods

with_error_handling(&block) click to toggle source
# File lib/deploy/error_handler.rb, line 13
def self.with_error_handling(&block)
  instance.with_error_handling(&block)
end

Public Instance Methods

with_error_handling() { || ... } click to toggle source
# File lib/deploy/error_handler.rb, line 17
def with_error_handling
  yield
rescue RuntimeError => error
  fail message_for(error)
end

Private Instance Methods

message_for(error) click to toggle source
# File lib/deploy/error_handler.rb, line 25
def message_for(error)
  message = ERROR_MESSAGES[error.class.name] || 'Unknown error'
  "#{message}: #{error}"
end