Exception: RequestParamsValidation::DefinitionArgumentError

Inherits:
DefinitionsError show all
Defined in:
lib/request_params_validation/exceptions/definitions_errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_msg, options = {}) ⇒ DefinitionArgumentError

Returns a new instance of DefinitionArgumentError.



16
17
18
19
20
21
# File 'lib/request_params_validation/exceptions/definitions_errors.rb', line 16

def initialize(error_msg, options = {})
  @error_msg = error_msg
  @resource  = options[:resource]

  super(message)
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



14
15
16
# File 'lib/request_params_validation/exceptions/definitions_errors.rb', line 14

def action
  @action
end

#resourceObject

Returns the value of attribute resource.



14
15
16
# File 'lib/request_params_validation/exceptions/definitions_errors.rb', line 14

def resource
  @resource
end

Instance Method Details

#messageObject



23
24
25
26
27
28
29
# File 'lib/request_params_validation/exceptions/definitions_errors.rb', line 23

def message
  if resource
    "Argument error for resource '#{resource}'. #{@error_msg}"
  else
    @error_msg
  end
end