lib/readability_parser/error.rb in readability_parser-0.0.3 vs lib/readability_parser/error.rb in readability_parser-0.0.4

- old
+ new

@@ -8,25 +8,26 @@ # Creates a new error from an HTTP environement # # @param response [Hash] # @return [ReadabilityParser::Error::ClientError] - def initialize(error=nil) + 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 + private - def parse_error(error) - MultiJson.load(error.response[:body], :symbolize_keys => true) - end + def parse_error(error) + MultiJson.load(error.response[:body], :symbolize_keys => true) + end end # ClientError class ConfigurationError < ReadabilityParser::Error; end # Raised when there's an error in Faraday