Exception: REXML::ParseException
- Defined in:
- lib/extensions/rexml/rexml/parseexception.rb,
lib/extensions/rhoxml/rexml/parseexception.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#continued_exception ⇒ Object
Returns the value of attribute continued_exception.
-
#parser ⇒ Object
Returns the value of attribute parser.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #context ⇒ Object
-
#initialize(message, source = nil, parser = nil, exception = nil) ⇒ ParseException
constructor
A new instance of ParseException.
- #line ⇒ Object
- #position ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(message, source = nil, parser = nil, exception = nil) ⇒ ParseException
Returns a new instance of ParseException.
5 6 7 8 9 10 |
# File 'lib/extensions/rexml/rexml/parseexception.rb', line 5 def initialize( , source=nil, parser=nil, exception=nil ) super() @source = source @parser = parser @continued_exception = exception end |
Instance Attribute Details
#continued_exception ⇒ Object
Returns the value of attribute continued_exception.
3 4 5 |
# File 'lib/extensions/rexml/rexml/parseexception.rb', line 3 def continued_exception @continued_exception end |
#parser ⇒ Object
Returns the value of attribute parser.
3 4 5 |
# File 'lib/extensions/rexml/rexml/parseexception.rb', line 3 def parser @parser end |
#source ⇒ Object
Returns the value of attribute source.
3 4 5 |
# File 'lib/extensions/rexml/rexml/parseexception.rb', line 3 def source @source end |
Instance Method Details
#context ⇒ Object
47 48 49 |
# File 'lib/extensions/rexml/rexml/parseexception.rb', line 47 def context @source.current_line end |
#line ⇒ Object
42 43 44 45 |
# File 'lib/extensions/rexml/rexml/parseexception.rb', line 42 def line @source.current_line[2] if @source and defined?( @source.current_line ) and @source.current_line end |
#position ⇒ Object
37 38 39 40 |
# File 'lib/extensions/rexml/rexml/parseexception.rb', line 37 def position @source.current_line[0] if @source and defined?( @source.current_line ) and @source.current_line end |
#to_s ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/extensions/rexml/rexml/parseexception.rb', line 12 def to_s # Quote the original exception, if there was one if @continued_exception err = @continued_exception.inspect err << "\n" err << @continued_exception.backtrace.join("\n") err << "\n...\n" else err = "" end # Get the stack trace and error message err << super # Add contextual information if @source err << "\nLine: #{line}\n" err << "Position: #{position}\n" err << "Last 80 unconsumed characters:\n" err << @source.buffer[0..80].gsub(/\n/, ' ') end err end |