Exception: MercuryParser::Error::ClientError
- Inherits:
-
MercuryParser::Error
- Object
- StandardError
- MercuryParser::Error
- MercuryParser::Error::ClientError
- Defined in:
- lib/mercury_parser/error.rb
Overview
Raised when Mercury returns a 4xx or 500 HTTP status code
Constant Summary
Constants inherited from MercuryParser::Error
Instance Method Summary collapse
-
#initialize(error = nil) ⇒ MercuryParser::Error::ClientError
constructor
Creates a new error from an HTTP environement.
Constructor Details
#initialize(error = nil) ⇒ MercuryParser::Error::ClientError
Creates a new error from an HTTP environement
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mercury_parser/error.rb', line 13 def initialize(error = nil) parsed_error = parse_error(error) http_error = error.response[:status].to_i if ERROR_MAP.has_key?(http_error) raise ERROR_MAP[http_error].new(parsed_error[:messages]) else super end end |