Exception: Uniword::ValidationError
- Defined in:
- lib/uniword/errors.rb
Overview
Raised when element validation fails
Instance Attribute Summary collapse
-
#element ⇒ Element
readonly
The element that failed.
-
#errors ⇒ Array<String>
readonly
The validation errors.
-
#issues ⇒ Array
readonly
Structured issues (code, part, message) — populated by the write-time package integrity gate.
Instance Method Summary collapse
-
#initialize(element, errors, issues: []) ⇒ ValidationError
constructor
A new instance of ValidationError.
Constructor Details
#initialize(element, errors, issues: []) ⇒ ValidationError
Returns a new instance of ValidationError.
59 60 61 62 63 64 65 |
# File 'lib/uniword/errors.rb', line 59 def initialize(element, errors, issues: []) element_name = element.class.name.split("::").last super("Validation failed for #{element_name}: #{errors.join(', ')}") @element = element @errors = errors @issues = issues end |
Instance Attribute Details
#element ⇒ Element (readonly)
Returns The element that failed.
68 69 70 |
# File 'lib/uniword/errors.rb', line 68 def element @element end |
#errors ⇒ Array<String> (readonly)
Returns The validation errors.
71 72 73 |
# File 'lib/uniword/errors.rb', line 71 def errors @errors end |
#issues ⇒ Array (readonly)
Returns Structured issues (code, part, message) — populated by the write-time package integrity gate.
75 76 77 |
# File 'lib/uniword/errors.rb', line 75 def issues @issues end |