Exception: MR::Model::InvalidError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/mr/model/persistence.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, errors, backtrace = nil) ⇒ InvalidError

Returns a new instance of InvalidError.



68
69
70
71
72
73
74
75
# File 'lib/mr/model/persistence.rb', line 68

def initialize(model, errors, backtrace = nil)
  @errors = errors || {}
  desc = @errors.map do |(attribute, messages)|
    messages.map{ |message| "#{attribute.inspect} #{message}" }
  end.sort.join(', ')
  super "Invalid #{model.class} couldn't be saved: #{desc}"
  set_backtrace(backtrace) if backtrace
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



66
67
68
# File 'lib/mr/model/persistence.rb', line 66

def errors
  @errors
end