Exception: XML_XSI::Schema::ValidationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/validate_xml_xsi.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, err, filename = nil) ⇒ ValidationError

Returns a new instance of ValidationError.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/validate_xml_xsi.rb', line 18

def initialize(type, err, filename = nil)
  @type = type
  @error = err
  @file = filename.nil? ? @error.file : filename
  @line = @error.line
  @column = @error.column
  if /((?:ERROR)|(?:WARNING)): /.match(@error.message)
    @level = $1
    @message = $'
    @description = "#{@type.to_s} #{@level.to_s} [#{@file}:#{@line}:#{@column}]: #{@message}".freeze
  else
    @level = ''
    @message = @error.message
    @description = "#{@type.to_s} #{@message}".freeze
  end
  super(@description)
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



17
18
19
# File 'lib/validate_xml_xsi.rb', line 17

def column
  @column
end

#descriptionObject (readonly)

Returns the value of attribute description.



17
18
19
# File 'lib/validate_xml_xsi.rb', line 17

def description
  @description
end

#errorObject (readonly)

Returns the value of attribute error.



17
18
19
# File 'lib/validate_xml_xsi.rb', line 17

def error
  @error
end

#fileObject (readonly)

Returns the value of attribute file.



17
18
19
# File 'lib/validate_xml_xsi.rb', line 17

def file
  @file
end

#levelObject (readonly)

Returns the value of attribute level.



17
18
19
# File 'lib/validate_xml_xsi.rb', line 17

def level
  @level
end

#lineObject (readonly)

Returns the value of attribute line.



17
18
19
# File 'lib/validate_xml_xsi.rb', line 17

def line
  @line
end

#messageObject (readonly)

Returns the value of attribute message.



17
18
19
# File 'lib/validate_xml_xsi.rb', line 17

def message
  @message
end

#typeObject (readonly)

Returns the value of attribute type.



17
18
19
# File 'lib/validate_xml_xsi.rb', line 17

def type
  @type
end