class Marver::API::ErrorHandler

Public Class Methods

new(ex) click to toggle source
# File lib/marver/api/errors.rb, line 4
def initialize(ex)
  @message = ex.response['status']
end

Public Instance Methods

handle!() click to toggle source
# File lib/marver/api/errors.rb, line 8
def handle!
  case @code
  when 401
    raise Marver::Error::CredentialsFault.new(@message)
  when 403
    raise Marver::Error::MethodNotAllowed.new(@message)
  when 404
    raise Marver::Error::NotFound.new(@message)
  when 405
    raise Marver::Error::Forbidden.new(@message)
  when 409
    raise Marver::Error::Conflict.new(@message)
  end
end