class MSS::Errors::Base
Base
class for all errors returned by the service.
Attributes
code[R]
@return [String] The response code given by the service.
http_request[R]
@return [Http::Request] The low level http request that caused the
error to be raised.
http_response[R]
@return [Http::Response] The low level http response from the service
that wrapped the service error.
Public Class Methods
new(req = nil, resp = nil, code = nil, message = nil)
click to toggle source
@overload new(error_message)
@param [String] error_message The body of the error message
@overload new(http_request
, http_response
, code = nil, message = nil)
@param [Http::Request] http_request @param [Http::Response] http_response @param [String] code (nil) @param [String] message (nil)
Calls superclass method
# File lib/mss/errors.rb, line 51 def initialize req = nil, resp = nil, code = nil, message = nil if req.is_a?(String) or req.nil? super(req) else @http_request = req @http_response = resp @code = code include_error_type super(message || http_response.body) end end
Protected Instance Methods
include_error_type()
click to toggle source
Extends the error object with {ServerError} or {ClientError}. This indicates if the request should be retried (server errors) or not (client errors).
# File lib/mss/errors.rb, line 79 def include_error_type if http_response.status >= 500 extend ServerError else extend ClientError end end