Sha256: 65df031c879005b3799a2d8e86bf79aeaeead4ec46c686be648d7925ad9bbb45

Contents?: true

Size: 787 Bytes

Versions: 11

Compression:

Stored size: 787 Bytes

Contents

module Fog
  module Rackspace
    module Errors

      def self.included(mod)
        mod.class_eval <<-'EOS', __FILE__, __LINE__
          class NotFound < Fog::Service::NotFound
            attr_reader :region, :status_code

            def to_s
              status = status_code ? "[HTTP #{status_code}] " : ""
              message = region ? "resource not found in #{region} region" : super
              "#{status}#{message}"
            end

            def self.slurp(error, region=nil)
              exception = NotFound.new
              exception.instance_variable_set(:@region, region)
              exception.instance_variable_set(:@status_code, error.response.status) rescue nil
              exception
            end
          end
        EOS
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
gapinc-fog-1.12.1.2.1 lib/fog/rackspace/errors.rb
fog-1.14.0 lib/fog/rackspace/errors.rb
fog-1.13.0 lib/fog/rackspace/errors.rb
gapinc-fog-1.12.1.2 lib/fog/rackspace/errors.rb
gapinc-fog-1.12.1.1 lib/fog/rackspace/errors.rb
gapinc-fog-1.12.1a lib/fog/rackspace/errors.rb
gapinc-fog-1.12.1 lib/fog/rackspace/errors.rb
fog-1.12.1 lib/fog/rackspace/errors.rb
fog-1.12.0 lib/fog/rackspace/errors.rb
fog-1.11.1 lib/fog/rackspace/errors.rb
fog-1.11.0 lib/fog/rackspace/errors.rb