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.



89
90
91
92
# File 'lib/pod4/errors.rb', line 89

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.



83
84
85
# File 'lib/pod4/errors.rb', line 83

def field
  @field
end

Class Method Details

.from_alert(alert) ⇒ Object



85
86
87
# File 'lib/pod4/errors.rb', line 85

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