Exception: OCTool::ValidationError

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

Overview

Custom error to show validation errors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, errors) ⇒ ValidationError

Returns a new instance of ValidationError.



8
9
10
11
# File 'lib/octool/parser.rb', line 8

def initialize(path, errors)
    @path = path
    @errors = errors
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



6
7
8
# File 'lib/octool/parser.rb', line 6

def errors
  @errors
end

Instance Method Details

#messageObject



13
14
15
16
17
18
19
# File 'lib/octool/parser.rb', line 13

def message
    msg = ["[ERROR] #{@path}"]
    @errors.each do |e|
        msg << "line #{e.linenum} col #{e.column} [#{e.path}] #{e.message}"
    end
    msg.join("\n")
end