lib/deepl/requests/base.rb in deepl-rb-2.5.1 vs lib/deepl/requests/base.rb in deepl-rb-2.5.2
- old
+ new
@@ -70,17 +70,10 @@
end
def validate_response!(request, response)
return if response.is_a?(Net::HTTPSuccess)
- case response.code
- when '400' then raise Exceptions::BadRequest.new(request, response)
- when '401', '403' then raise Exceptions::AuthorizationFailed.new(request, response)
- when '404' then raise Exceptions::NotFound.new(request, response)
- when '429' then raise Exceptions::LimitExceeded.new(request, response)
- when '456' then raise Exceptions::QuotaExceeded.new(request, response)
- else raise Exceptions::RequestError.new(request, response)
- end
+ raise Utils::ExceptionBuilder.new(request, response).build
end
def path
raise NotImplementedError
end