Exception: Kwalify::BaseError

Inherits:
KwalifyError show all
Defined in:
lib/kwalify/errors.rb

Direct Known Subclasses

SchemaError, ValidationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = "", path = nil, value = nil, rule = nil, error_symbol = nil) ⇒ BaseError

Returns a new instance of BaseError.



23
24
25
26
27
28
29
# File 'lib/kwalify/errors.rb', line 23

def initialize(message="", path=nil, value=nil, rule=nil, error_symbol=nil)
   super(message)
   @error_symbol = error_symbol
   @rule         = rule
   @path         = path
   @value        = value
end

Instance Attribute Details

#error_symbolObject (readonly)

Returns the value of attribute error_symbol.



30
31
32
# File 'lib/kwalify/errors.rb', line 30

def error_symbol
  @error_symbol
end

#linenumObject

Returns the value of attribute linenum.



31
32
33
# File 'lib/kwalify/errors.rb', line 31

def linenum
  @linenum
end

#pathObject (readonly)

Returns the value of attribute path.



30
31
32
# File 'lib/kwalify/errors.rb', line 30

def path
  @path
end

#ruleObject (readonly)

Returns the value of attribute rule.



30
31
32
# File 'lib/kwalify/errors.rb', line 30

def rule
  @rule
end

#valueObject (readonly)

Returns the value of attribute value.



30
31
32
# File 'lib/kwalify/errors.rb', line 30

def value
  @value
end

Instance Method Details

#_to_sObject



37
# File 'lib/kwalify/errors.rb', line 37

alias :_to_s :to_s

#messageObject



39
40
41
# File 'lib/kwalify/errors.rb', line 39

def message
   _to_s
end

#to_sObject



43
44
45
# File 'lib/kwalify/errors.rb', line 43

def to_s
   return "[#{path()}] #{message()}"
end