Sha256: 895ee79d2e82453d0129af2bda3223c9375bea9de49b0f09d31f333de3ba3a9c

Contents?: true

Size: 855 Bytes

Versions: 3

Compression:

Stored size: 855 Bytes

Contents

module Blather

# General SASL Errors
# Check #name for the error name
#
# @handler :sasl_error
class SASLError < BlatherError
  # @private
  SASL_ERR_NS = 'urn:ietf:params:xml:ns:xmpp-sasl'

  class_inheritable_accessor :err_name
  # @private
  @@registrations = {}

  register :sasl_error

  # Import the stanza
  #
  # @param [Blather::XMPPNode] node the error node
  # @return [Blather::SASLError]
  def self.import(node)
    self.new node
  end

  # Create a new SASLError
  #
  # @param [Blather::XMPPNode] node the error node
  def initialize(node)
    super()
    @node = node
  end

  # The actual error name
  #
  # @return [Symbol] a symbol representing the error name
  def name
    if @node
      name = @node.find_first('ns:*', :ns => SASL_ERR_NS).element_name
      name.gsub('-', '_').to_sym
    end
  end
end  # SASLError

end  # Blather

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blather-0.5.3 lib/blather/errors/sasl_error.rb
blather-0.5.2 lib/blather/errors/sasl_error.rb
blather-0.5.0 lib/blather/errors/sasl_error.rb