Sha256: 8d03f70ecb2cee05ae70fa8e131a01c2fda0eeaa7f8bdaa30339c1b8b64aa3cd

Contents?: true

Size: 1.33 KB

Versions: 413

Compression:

Stored size: 1.33 KB

Contents

=begin
#Pulp 3 API

#Fetch, Upload, Organize, and Distribute Software Packages

The version of the OpenAPI document: v3
Contact: pulp-list@redhat.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.1

=end

module Pulp2to3MigrationClient
  class ApiError < StandardError
    attr_reader :code, :response_headers, :response_body

    # Usage examples:
    #   ApiError.new
    #   ApiError.new("message")
    #   ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
    #   ApiError.new(:code => 404, :message => "Not Found")
    def initialize(arg = nil)
      if arg.is_a? Hash
        if arg.key?(:message) || arg.key?('message')
          super(arg[:message] || arg['message'])
        else
          super arg
        end

        arg.each do |k, v|
          instance_variable_set "@#{k}", v
        end
      else
        super arg
      end
    end

    # Override to_s to display a friendly error message
    def to_s
      message
    end

    def message
      if @message.nil?
        msg = "Error message: the server returns an error"
      else
        msg = @message
      end

      msg += "\nHTTP status code: #{code}" if code
      msg += "\nResponse headers: #{response_headers}" if response_headers
      msg += "\nResponse body: #{response_body}" if response_body

      msg
    end
  end
end

Version data entries

413 entries across 413 versions & 1 rubygems

Version Path
pulp_2to3_migration_client-0.18.0.dev1671765225 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1671678963 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1671592211 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1671506063 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1671419627 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1671333069 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1671246951 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1671160190 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1671074404 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670987924 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670901366 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670815114 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670728588 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670641882 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670555531 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670469188 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670382867 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670296237 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670209800 lib/pulp_2to3_migration_client/api_error.rb
pulp_2to3_migration_client-0.18.0.dev1670123512 lib/pulp_2to3_migration_client/api_error.rb