lib/brazil_cep/adapters/base.rb in brazil-cep-0.2.0 vs lib/brazil_cep/adapters/base.rb in brazil-cep-0.3.0

- old
+ new

@@ -29,10 +29,11 @@ # @return [Hash] the address information def fetch(value = nil) @cep = value unless value.nil? http_request(provider_url) do |http_response| - raise Brazil::Cep::RequestError, http_response unless http_response.is_a?(Net::HTTPSuccess) + raise Brazil::Cep::ZipcodeNotFound, http_response if http_response.is_a?(Net::HTTPNotFound) + raise Brazil::Cep::RequestError, http_response if http_response.code.to_i >= 400 end deserialization! transformation! end