lib/mrkt/faraday_middleware/response.rb in mrkt-0.7.0 vs lib/mrkt/faraday_middleware/response.rb in mrkt-0.8.0
- old
+ new
@@ -10,20 +10,20 @@
def process_response(env)
super
data = env[:body]
- fail Mrkt::Errors::EmptyResponse if data.nil?
- fail Mrkt::Errors::Error, data[:error_description] if data.key?(:error)
+ raise Mrkt::Errors::EmptyResponse if data.nil?
+ raise Mrkt::Errors::Error, data[:error_description] if data.key?(:error)
handle_errors!(data[:errors]) unless data.fetch(:success, true)
end
def handle_errors!(errors)
error = errors.first
- fail Mrkt::Errors::Unknown if error.nil?
- fail Mrkt::Errors.find_by_response_code(error[:code].to_i), error[:message]
+ raise Mrkt::Errors::Unknown if error.nil?
+ raise Mrkt::Errors.find_by_response_code(error[:code].to_i), error[:message]
end
end
end
end