Sha256: a638451ded50b6b492056eacc6f80c9dd45d839e2c75fca5f89cf74528bbf4a1

Contents?: true

Size: 895 Bytes

Versions: 19

Compression:

Stored size: 895 Bytes

Contents

module Azure
  module Armrest
    class Exception < StandardError
      attr_accessor :cause
      attr_writer :message

      def initialize(message = nil, cause_exception = nil)
        @message = message
        @cause = cause_exception
      end

      def to_s
        message
      end

      def message
        @message || self.class.name
      end
    end

    class ApiException < Exception
      attr_accessor :code

      def initialize(code, message, cause_exception)
        @code = code
        super(message, cause_exception)
      end

      def to_s
        "[#{code}] #{message}"
      end
    end

    class ResourceNotFoundException < ApiException; end

    class BadRequestException < ApiException; end

    class UnauthorizedException < ApiException; end

    class BadGatewayException < ApiException; end

    class GatewayTimeoutException < ApiException; end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
azure-armrest-0.2.8 lib/azure/armrest/exception.rb
azure-armrest-0.2.7 lib/azure/armrest/exception.rb
azure-armrest-0.2.6 lib/azure/armrest/exception.rb
azure-armrest-0.2.5 lib/azure/armrest/exception.rb
azure-armrest-0.2.4 lib/azure/armrest/exception.rb
azure-armrest-0.2.3 lib/azure/armrest/exception.rb
azure-armrest-0.2.2 lib/azure/armrest/exception.rb
azure-armrest-0.2.1 lib/azure/armrest/exception.rb
azure-armrest-0.2.0 lib/azure/armrest/exception.rb
azure-armrest-0.1.3 lib/azure/armrest/exception.rb
azure-armrest-0.1.2 lib/azure/armrest/exception.rb
azure-armrest-0.1.1 lib/azure/armrest/exception.rb
azure-armrest-0.1.0 lib/azure/armrest/exception.rb
azure-armrest-0.0.9 lib/azure/armrest/exception.rb
azure-armrest-0.0.8 lib/azure/armrest/exception.rb
azure-armrest-0.0.7 lib/azure/armrest/exception.rb
azure-armrest-0.0.6 lib/azure/armrest/exception.rb
azure-armrest-0.0.5 lib/azure/armrest/exception.rb
azure-armrest-0.0.4 lib/azure/armrest/exception.rb