class Apia::InvalidArgumentError
Raised when an argument set cannot be created based on the source object that has been provided. For example, if a validation rule exists or a scalar cannot be parsed for the underlying object.
This is not raised for MISSING argument errors.
Constants
- ISSUE_DESCRIPTIONS
Attributes
argument[R]
errors[R]
index[R]
issue[R]
path[R]
Public Class Methods
new(argument, issue: nil, index: nil, path: [], errors: [])
click to toggle source
# File lib/apia/errors/invalid_argument_error.rb, line 28 def initialize(argument, issue: nil, index: nil, path: [], errors: []) @argument = argument @index = index @path = path @issue = issue @errors = errors end
Public Instance Methods
hash()
click to toggle source
# File lib/apia/errors/invalid_argument_error.rb, line 48 def hash { code: 'invalid_argument', description: "The '#{path_string}' argument is invalid", detail: { path: @path.map(&:name), index: @index, issue: @issue&.to_s, issue_description: ISSUE_DESCRIPTIONS[@issue.to_sym], errors: @errors, argument: { id: argument.id, name: argument.name, description: argument.description } } } end
http_status()
click to toggle source
# File lib/apia/errors/invalid_argument_error.rb, line 40 def http_status 400 end
path_string()
click to toggle source
# File lib/apia/errors/invalid_argument_error.rb, line 44 def path_string @path.map(&:name).join('.') end
to_s()
click to toggle source
# File lib/apia/errors/invalid_argument_error.rb, line 36 def to_s @issue.to_s end