Sha256: ae080d3d5dbdfd990490a38eb901ab8b449a1d20300d3a824e298c9d1649b1b0

Contents?: true

Size: 951 Bytes

Versions: 6

Compression:

Stored size: 951 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

    class TooManyRequestsException < ApiException; end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
azure-armrest-0.3.5 lib/azure/armrest/exception.rb
azure-armrest-0.3.4 lib/azure/armrest/exception.rb
azure-armrest-0.3.3 lib/azure/armrest/exception.rb
azure-armrest-0.3.2 lib/azure/armrest/exception.rb
azure-armrest-0.3.1 lib/azure/armrest/exception.rb
azure-armrest-0.3.0 lib/azure/armrest/exception.rb