Sha256: 3cae99d73110419b13d459e7d1552985603030d89682d1266a3b6854dc61eec7

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 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 this page with the current organization."
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zuora_connect-3.1.5.pre.f lib/zuora_connect/exceptions.rb