Exception: Common::Exceptions::SchemaValidationErrors
- Inherits:
-
BaseError
- Object
- StandardError
- BaseError
- Common::Exceptions::SchemaValidationErrors
- Defined in:
- lib/common/exceptions/schema_validation_errors.rb
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(resource) ⇒ SchemaValidationErrors
constructor
A new instance of SchemaValidationErrors.
Methods inherited from BaseError
#i18n_data, #i18n_field, #i18n_interpolated, #i18n_key, #log_to_sentry?, #message, #sentry_type, #status_code
Constructor Details
#initialize(resource) ⇒ SchemaValidationErrors
Returns a new instance of SchemaValidationErrors.
9 10 11 12 |
# File 'lib/common/exceptions/schema_validation_errors.rb', line 9 def initialize(resource) @resource = resource raise TypeError, 'the resource provided has no errors' if resource.blank? end |
Instance Method Details
#errors ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/common/exceptions/schema_validation_errors.rb', line 14 def errors @resource.map do |error| SerializableError.new( i18n_data.merge( detail: error ) ) end end |