Exception: Moxml::ParseError

Inherits:
Error
  • Object
show all
Defined in:
lib/moxml/error.rb

Overview

Error raised when parsing XML fails

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, line: nil, column: nil, source: nil) ⇒ ParseError

Returns a new instance of ParseError.



11
12
13
14
15
16
# File 'lib/moxml/error.rb', line 11

def initialize(message, line: nil, column: nil, source: nil)
  @line = line
  @column = column
  @source = source
  super(message)
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



9
10
11
# File 'lib/moxml/error.rb', line 9

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



9
10
11
# File 'lib/moxml/error.rb', line 9

def line
  @line
end

#sourceObject (readonly)

Returns the value of attribute source.



9
10
11
# File 'lib/moxml/error.rb', line 9

def source
  @source
end

Instance Method Details

#to_sObject



18
19
20
21
22
23
24
25
# File 'lib/moxml/error.rb', line 18

def to_s
  msg = super
  msg += "\n  Line: #{@line}" if @line
  msg += "\n  Column: #{@column}" if @column
  msg += "\n  Source: #{@source.inspect}" if @source
  msg += "\n  Hint: Check XML syntax and ensure all tags are properly closed"
  msg
end