Module: DeltaCloud::HTTPError

Defined in:
lib/errors.rb

Defined Under Namespace

Classes: BadRequest, ClientError, DeltacloudError, ExceptionHandler, ExpectationFailed, Forbidden, Gone, MethodNotAllowed, NotAcceptable, NotFound, NotImplemented, ProviderError, ProviderTimeout, RequestTimeout, ServerError, ServiceUnavailable, UknownError, Unauthorized, UnsupportedMediaType

Class Method Summary collapse

Class Method Details

.client_error(code) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/errors.rb', line 102

def self.client_error(code)
  ExceptionHandler.new(code) do
    # Client errors
    on 400, BadRequest
    on 401, Unauthorized
    on 403, Forbidden
    on 404, NotFound
    on 405, MethodNotAllowed
    on 406, NotAcceptable
    on 408, RequestTimeout
    on 410, Gone
  end
end

.parse_response_error(response) ⇒ Object



98
99
100
# File 'lib/errors.rb', line 98

def self.parse_response_error(response)

end

.server_error(code, message, opts = {}, backtrace = nil) ⇒ Object

Raises:

  • (Deltacloud::HTTPError::UnknownError)


116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/errors.rb', line 116

def self.server_error(code, message, opts={}, backtrace=nil)
  ExceptionHandler.new(code, message, opts, backtrace) do
    # Client errors
    on 400, BadRequest
    on 401, Unauthorized
    on 403, Forbidden
    on 404, NotFound
    on 405, MethodNotAllowed
    on 406, NotAcceptable
    on 408, RequestTimeout
    on 410, Gone
    on 415, UnsupportedMediaType
    on 417, ExpectationFailed
    # Server errors
    on 500, DeltacloudError
    on 501, NotImplemented
    on 502, ProviderError
    on 503, ServiceUnavailable
    on 504, ProviderTimeout
  end
  raise Deltacloud::HTTPError::UnknownError.new(code, message, opts, backtrace)
end