Sha256: 1feec765086ddd04c31b1c5255abdde2816c74dd3d54bcc08e73adb12af93ad3

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

module Mack
  module Errors # :nodoc:
    
    class UnconvertedNotifier < StandardError
      def initialize # :nodoc:
        super("You must convert the Mack::Notifier object first!")
      end
    end # UnconvertedNotifier
    
    class XmppError < StandardError
      def initialize(msg)
        super(msg)
        self.error_hash = {}
      end
      
      def add_error(type, msg)
        self.error_hash[type] ||= []
        self.error_hash[type] << msg
      end
      
      def get_error(type)
        self.error_hash[type]
      end
      
      def empty?
        self.error_hash.empty?
      end
      
      attr_accessor :error_hash
    end
    
    class XmppAuthenticationError < StandardError
      def initialize(user)
        super("Cannot authenticate: #{user} to xmpp server")
      end
    end
    
    class XmppUserNotOnline < StandardError
      def initialize(user)
        super("user #{user} is not online")
      end
    end
    
    class XmppSendError < StandardError
      attr_reader :code
      attr_reader :msg
      
      def initialize(code, msg)
        super("Cannot send message. Code=#{code}, Msg=#{msg}")
        @code = code
        @msg = msg
      end
    end
  end # Errors
end # Mack

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mack-notifier-0.8.1 lib/mack-notifier/errors.rb
mack-notifier-0.8.2 lib/mack-notifier/errors.rb
mack-notifier-0.8.3 lib/mack-notifier/errors.rb
mack-notifier-0.8.3.1 lib/mack-notifier/errors.rb