18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/core/core.rb', line 18
def self.schema_validation(opts, schema, logger)
begin
results = schema.call(opts)
return if results.success?
begin
schema_name = schema.name
logger.debug("NetHTTP::Core::SchemaValidationError - #{schema_name} input validation failed due to => #{results.messages}")
raise("NetHTTP::Core::SchemaValidationError - #{schema_name} input validation failed due to => #{results.messages}")
rescue RuntimeError => error
logger.debug("NetHTTP::Core::SchemaValidationError - Dry::Validation::Schema input validation failed due to => #{results.messages}")
raise("NetHTTP::Core::SchemaValidationError - Dry::Validation::Schema input validation failed due to => #{results.messages}")
end
rescue RuntimeError => error
logger.debug(error)
logger.debug("NetHTTP::Core::SchemaValidationError - Dry::Validation::Schema input validation failed.")
raise error
end
end
|