Exception: Purl::ValidationError
- Defined in:
- lib/purl/errors.rb
Overview
Validation errors for PURL components
Contains additional context about which component failed validation and what rule was violated.
Direct Known Subclasses
InvalidNameError, InvalidNamespaceError, InvalidQualifierError, InvalidSubpathError, InvalidTypeError, InvalidVersionError
Instance Attribute Summary collapse
-
#component ⇒ Symbol?
readonly
The PURL component that failed validation.
-
#rule ⇒ String?
readonly
The validation rule that was violated.
-
#value ⇒ Object?
readonly
The value that failed validation.
Instance Method Summary collapse
-
#initialize(message, component: nil, value: nil, rule: nil) ⇒ ValidationError
constructor
A new instance of ValidationError.
Constructor Details
#initialize(message, component: nil, value: nil, rule: nil) ⇒ ValidationError
Returns a new instance of ValidationError.
33 34 35 36 37 38 |
# File 'lib/purl/errors.rb', line 33 def initialize(, component: nil, value: nil, rule: nil) super() @component = component @value = value @rule = rule end |
Instance Attribute Details
#component ⇒ Symbol? (readonly)
Returns the PURL component that failed validation.
21 22 23 |
# File 'lib/purl/errors.rb', line 21 def component @component end |
#rule ⇒ String? (readonly)
Returns the validation rule that was violated.
27 28 29 |
# File 'lib/purl/errors.rb', line 27 def rule @rule end |
#value ⇒ Object? (readonly)
Returns the value that failed validation.
24 25 26 |
# File 'lib/purl/errors.rb', line 24 def value @value end |