Exception: Pangea::Errors::ValidationError
Instance Attribute Summary
Attributes inherited from PangeaError
#cause_chain, #context, #timestamp
Class Method Summary
collapse
-
.invalid_attribute(resource, attribute, value, expected) ⇒ Object
-
.invalid_reference(source, target, reason) ⇒ Object
-
.invalid_type(resource, attribute, expected_type, actual_type) ⇒ Object
-
.missing_required(resource, attribute) ⇒ Object
-
.out_of_range(resource, attribute, value, range) ⇒ Object
Methods inherited from PangeaError
#detailed_message, #initialize, #to_h
Class Method Details
.invalid_attribute(resource, attribute, value, expected) ⇒ Object
79
80
81
82
|
# File 'lib/pangea/errors.rb', line 79
def self.invalid_attribute(resource, attribute, value, expected)
new("#{resource}: Invalid #{attribute} '#{value}'. Expected: #{expected}",
context: { resource: resource, attribute: attribute, value: value, expected: expected })
end
|
.invalid_reference(source, target, reason) ⇒ Object
89
90
91
92
|
# File 'lib/pangea/errors.rb', line 89
def self.invalid_reference(source, target, reason)
new("Invalid reference from #{source} to #{target}. Reason: #{reason}",
context: { source: source, target: target, reason: reason })
end
|
.invalid_type(resource, attribute, expected_type, actual_type) ⇒ Object
94
95
96
97
|
# File 'lib/pangea/errors.rb', line 94
def self.invalid_type(resource, attribute, expected_type, actual_type)
new("#{resource}: Invalid type for '#{attribute}'. Expected: #{expected_type}, Got: #{actual_type}",
context: { resource: resource, attribute: attribute, expected_type: expected_type, actual_type: actual_type })
end
|
.missing_required(resource, attribute) ⇒ Object
84
85
86
87
|
# File 'lib/pangea/errors.rb', line 84
def self.missing_required(resource, attribute)
new("#{resource}: Missing required attribute '#{attribute}'",
context: { resource: resource, attribute: attribute })
end
|
.out_of_range(resource, attribute, value, range) ⇒ Object
99
100
101
102
|
# File 'lib/pangea/errors.rb', line 99
def self.out_of_range(resource, attribute, value, range)
new("#{resource}: Value '#{value}' for '#{attribute}' is out of range. Expected: #{range}",
context: { resource: resource, attribute: attribute, value: value, range: range })
end
|