Exception: OpenMeteo::Entities::Contracts::ApplicationContract::ValidationError
- Inherits:
-
StandardError
- Object
- StandardError
- OpenMeteo::Entities::Contracts::ApplicationContract::ValidationError
- Defined in:
- lib/open_meteo/entities/contracts/application_contract.rb
Overview
A validation error that can be raised on contract validation.
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(result) ⇒ ValidationError
constructor
A new instance of ValidationError.
Constructor Details
#initialize(result) ⇒ ValidationError
Returns a new instance of ValidationError.
12 13 14 15 16 17 18 19 20 |
# File 'lib/open_meteo/entities/contracts/application_contract.rb', line 12 def initialize(result) @errors = result.errors first_error_key = result.errors.first.path.first first_error_value = result[first_error_key] super( "Validation failed: :#{first_error_key} is #{first_error_value} but #{errors.first.text}", ) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
10 11 12 |
# File 'lib/open_meteo/entities/contracts/application_contract.rb', line 10 def errors @errors end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
10 11 12 |
# File 'lib/open_meteo/entities/contracts/application_contract.rb', line 10 def result @result end |