Sha256: a08e47413c6ad02edc6757f826a0f0530058c61138230fb883eab64ac8d0066e
Contents?: true
Size: 822 Bytes
Versions: 3
Compression:
Stored size: 822 Bytes
Contents
require 'json' module Docker module Remote module Utils def potentially_raise_error!(response) case response.code.to_i when 401 raise UnauthorizedError, "401 Unauthorized: #{response.message}" when 404 json = JSON.parse(response.body) rescue {} error = (json['errors'] || []).first || {} if error['code'] == 'NAME_UNKNOWN' raise UnknownRepoError, error['message'] end raise NotFoundError, "404 Not Found: #{response.message}" end case response.code.to_i / 100 when 4 raise ClientError, "#{response.code}: #{response.message}" when 5 raise ServerError, "#{response.code}: #{response.message}" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
docker-remote-0.8.0 | lib/docker/remote/utils.rb |
docker-remote-0.7.0 | lib/docker/remote/utils.rb |
docker-remote-0.6.0 | lib/docker/remote/utils.rb |