Exception: XML::SAX::SAXException

Inherits:
Exception
  • Object
show all
Defined in:
lib/xml/sax.rb

Direct Known Subclasses

SAXParseException

Instance Method Summary collapse

Constructor Details

#initialize(message, e = nil) ⇒ SAXException

initialize(String) initialize(Exception) initialize(String, Exception)



246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/xml/sax.rb', line 246

def initialize(message, e = nil)
  @message = nil
  @exception = nil
  if message.kind_of?(String) && e.nil?
    @message = message
  elsif message.kind_of?(Exception) && e.nil?
    @exception = e
  elsif message.kind_of?(String) && e.kind_of?(Exception)
    @message = message
    @exception = e
  else
    raise TypeError.new("parameter error")
  end
end

Instance Method Details

#getExceptionObject



268
269
270
# File 'lib/xml/sax.rb', line 268

def getException
  @exception
end

#getMessageObject



261
262
263
264
265
266
# File 'lib/xml/sax.rb', line 261

def getMessage
  if @message.nil? && !@exception.nil?
    return @exception.to_s
  end
  @message
end

#toStringObject Also known as: to_s



272
273
274
# File 'lib/xml/sax.rb', line 272

def toString
  getMessage
end