Sha256: c1aa2ee988b27b8d1fe35f6f46a578fea6ea9064e9a85d5000ba64de89687e09

Contents?: true

Size: 1.92 KB

Versions: 12

Compression:

Stored size: 1.92 KB

Contents

module ZuoraConnect
  module Exceptions

    class HoldingPattern < StandardError; end
    class MissMatch < StandardError; end
    class InvalidCredentialSet < StandardError; end
    class Error < StandardError; end
    class AuthorizationNotPerformed < Error; end

    class SessionInvalid < Error
      attr_writer :default_message

      def initialize(message = nil)
        @message = message
        @default_message = "Session data invalid."
      end

      def to_s
        @message || @default_message
      end
    end

    class ConnectCommunicationError < Error
      attr_reader :code, :response
      attr_writer :default_message

      def initialize(message = nil,response=nil, code =nil)
        @code = code
        @message = message
        @response = response
        @default_message = "Error communication with Connect."
      end

      def to_s
        @message || @default_message
      end
    end

    class APIError < Error
      attr_reader :code, :response
      attr_writer :default_message

      def initialize(message: nil, response: nil)
        @code = response.class.to_s == "HTTParty::Response" ? response.code : nil
        @message = message
        @response = response
        @default_message = "Connect update error."
      end

      def to_s
        @message || @default_message
      end

    end

    class AccessDenied < Error
      attr_writer :default_message

      def initialize(message = nil)
        @message = message
        @default_message = "You are not authorized to access this page."
      end

      def to_s
        @message || @default_message
      end
    end


    class OrganizationAccessForbidden < Error
      attr_writer :default_message

      def initialize(message = nil)
        @message = message
        @default_message = "You are not authorized to access with the current organization."
      end

      def to_s
        @message || @default_message
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
zuora_connect-3.2.11 lib/zuora_connect/exceptions.rb
zuora_connect-3.2.10 lib/zuora_connect/exceptions.rb
zuora_connect-3.2.9 lib/zuora_connect/exceptions.rb
zuora_connect-3.2.8 lib/zuora_connect/exceptions.rb
zuora_connect-3.2.7 lib/zuora_connect/exceptions.rb
zuora_connect-3.2.6 lib/zuora_connect/exceptions.rb
zuora_connect-3.2.5 lib/zuora_connect/exceptions.rb
zuora_connect-3.2.4 lib/zuora_connect/exceptions.rb
zuora_connect-3.2.3 lib/zuora_connect/exceptions.rb
zuora_connect-3.2.2 lib/zuora_connect/exceptions.rb
zuora_connect-3.2.0 lib/zuora_connect/exceptions.rb
zuora_connect-3.1.5.pre.g lib/zuora_connect/exceptions.rb