Exception: Pod4::ValidationError

Inherits:
Pod4Error
  • Object
show all
Defined in:
lib/pod4/errors.rb

Overview

Raised if validation fails (and you wanted an exception…)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, field = nil) ⇒ ValidationError

Returns a new instance of ValidationError.



75
76
77
78
# File 'lib/pod4/errors.rb', line 75

def initialize(message=nil, field=nil)
  super(message || $! && $!.message)
  @field = field.to_s.to_sym
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



69
70
71
# File 'lib/pod4/errors.rb', line 69

def field
  @field
end

Class Method Details

.from_alert(alert) ⇒ Object



71
72
73
# File 'lib/pod4/errors.rb', line 71

def self.from_alert(alert)
  self.new(alert.message, alert.field)
end