Sha256: 18ce61222b3b03c6204594ed7ce09c063d8fe180f94b72597f8de45db9fb24ea

Contents?: true

Size: 842 Bytes

Versions: 11

Compression:

Stored size: 842 Bytes

Contents

module Blather

# General SASL Errors
# Check #name for the error name
#
# @handler :sasl_error
class SASLError < BlatherError
  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

11 entries across 11 versions & 2 rubygems

Version Path
blather-0.4.16 lib/blather/errors/sasl_error.rb
blather-0.4.15 lib/blather/errors/sasl_error.rb
shingara-blather-0.4.14 lib/blather/errors/sasl_error.rb
blather-0.4.14 lib/blather/errors/sasl_error.rb
blather-0.4.13 lib/blather/errors/sasl_error.rb
blather-0.4.12 lib/blather/errors/sasl_error.rb
blather-0.4.11 lib/blather/errors/sasl_error.rb
blather-0.4.10 lib/blather/errors/sasl_error.rb
shingara-blather-0.4.9 lib/blather/errors/sasl_error.rb
shingara-blather-0.4.8 lib/blather/errors/sasl_error.rb
blather-0.4.8 lib/blather/errors/sasl_error.rb