Class: SalesforceApi::Errors::ErrorManager

Inherits:
Object
  • Object
show all
Defined in:
lib/salesforceapi-rest/errors.rb

Class Method Summary collapse

Class Method Details

.raise_error(message, http_code) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/salesforceapi-rest/errors.rb', line 73

def self.raise_error(message, http_code)
  case http_code
  when 400
    raise SalesforceApi::Errors::RequestError.new(message, http_code)
  when 401
    raise SalesforceApi::Errors::AuthenticationError.new(message, http_code)
  when 403
    raise SalesforceApi::Errors::RequestError.new(message, http_code)
  when 404
    raise SalesforceApi::Errors::ResourceNotFoundError.new(message, http_code)
  when 405
    raise SalesforceApi::Errors::MethodError.new(message, http_code)
  when 415
    raise SalesforceApi::Errors::EntityError.new(message, http_code)
  when 500
    raise SalesforceApi::Errors::PlatformError.new(message, http_code)
  else
    raise SalesforceApi::Errors::RuntimeError.new(message, http_code)
  end
end