Sha256: 4e5500ba2fe8d81d6cb30245cb0302baa35b84e3276bf9c116fa0214b0db00b5

Contents?: true

Size: 893 Bytes

Versions: 10

Compression:

Stored size: 893 Bytes

Contents

module Bamboozled
  class HTTPError < StandardError
    attr_reader :response
    attr_reader :params
    attr_reader :hint

    def initialize(response, params = {}, hint = nil)
      @response = response
      @params = params
      @hint = hint
      super(response)
    end

    def to_s
      "#{self.class} : #{response.code} #{response.body}".tap do |msg|
        msg << "\n#{hint}" if hint
      end
    end
  end

  class BadRequest < HTTPError; end
  class Unauthorized < HTTPError; end
  class AuthenticationFailed < HTTPError; end
  class Forbidden < HTTPError; end
  class NotFound < HTTPError; end
  class NotAcceptable < HTTPError; end
  class Conflict < HTTPError; end
  class LimitExceeded < HTTPError; end
  class InternalServerError < HTTPError; end
  class GatewayError < HTTPError; end
  class ServiceUnavailable < HTTPError; end
  class InformBamboo < HTTPError; end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
bamboozled-gitlab-0.2.15 lib/bamboozled/errors.rb
bamboozled-gitlab-0.2.14 lib/bamboozled/errors.rb
bamboozled-gitlab-0.2.13 lib/bamboozled/errors.rb
bamboozled-gitlab-0.2.12 lib/bamboozled/errors.rb
bamboozled-gitlab-0.2.11 lib/bamboozled/errors.rb
bamboozled-gitlab-0.2.10 lib/bamboozled/errors.rb
bamboozled-gitlab-0.2.9 lib/bamboozled/errors.rb
bamboozled-0.3.0 lib/bamboozled/errors.rb
bamboozled-0.2.0 lib/bamboozled/errors.rb
bamboozled-0.1.0 lib/bamboozled/errors.rb