Class: Gizmo::ValidationError

Inherits:
Error
  • Object
show all
Defined in:
lib/gizmo/models/validation_error.rb

Instance Attribute Summary collapse

Attributes inherited from Error

#backtrace, #message

Instance Method Summary collapse

Constructor Details

#initialize(message, errors, backtrace = nil) ⇒ ValidationError

Returns a new instance of ValidationError.



5
6
7
8
9
# File 'lib/gizmo/models/validation_error.rb', line 5

def initialize(message, errors, backtrace=nil)
  @message = message
  @errors = errors
  @backtrace = backtrace
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'lib/gizmo/models/validation_error.rb', line 3

def errors
  @errors
end

Instance Method Details

#as_json(opts = {}) ⇒ Object



11
12
13
# File 'lib/gizmo/models/validation_error.rb', line 11

def as_json(opts={})
  {message: message, errors: errors, backtrace: backtrace}
end