Class: Glia::Errors::HeadersValidationError
- Defined in:
- lib/glia/errors/client_errors.rb
Instance Attribute Summary
Attributes inherited from Error
#error_details, #message, #ref, #type
Instance Method Summary collapse
-
#initialize(error_details:, message: nil) ⇒ HeadersValidationError
constructor
A new instance of HeadersValidationError.
Methods inherited from Error
Constructor Details
#initialize(error_details:, message: nil) ⇒ HeadersValidationError
Returns a new instance of HeadersValidationError.
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/glia/errors/client_errors.rb', line 352 def initialize(error_details:, message: nil) raise ArgumentError, 'At least 1 error detail is required' if error_details.keys.count.zero? error_details.each_value do |value| raise ArgumentError, 'error_details values must be lists' unless value.is_a?(Array) end error_details.each_key { |key| Naming.assert_header(key) } super( type: HEADERS_VALIDATION_ERROR, ref: create_ref(HEADERS_VALIDATION_ERROR), message: || 'Headers are invalid', error_details: error_details ) end |