Exception: Shaf::Errors::ValidationError
- Inherits:
-
ServerError
- Object
- StandardError
- Shaf::Error
- ServerError
- Shaf::Errors::ValidationError
- Defined in:
- lib/shaf/errors.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Attributes inherited from ServerError
Class Method Summary collapse
Instance Method Summary collapse
- #http_status ⇒ Object
-
#initialize(msg, fields) ⇒ ValidationError
constructor
A new instance of ValidationError.
Constructor Details
#initialize(msg, fields) ⇒ ValidationError
Returns a new instance of ValidationError.
125 126 127 128 129 |
# File 'lib/shaf/errors.rb', line 125 def initialize(msg, fields) msg ||= "The entity being created/updated is invalid" super(msg, code: "VALIDATION_ERROR", title: "Invalid entity") @fields = fields || {} end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
113 114 115 |
# File 'lib/shaf/errors.rb', line 113 def fields @fields end |
Class Method Details
.from_sequel(validation_failed) ⇒ Object
115 116 117 118 119 |
# File 'lib/shaf/errors.rb', line 115 def self.from_sequel(validation_failed) new(validation_failed., validation_failed.errors).tap do |err| err.set_backtrace(validation_failed.backtrace) end end |
Instance Method Details
#http_status ⇒ Object
121 122 123 |
# File 'lib/shaf/errors.rb', line 121 def http_status 422 end |