Exception: RequestParamsValidation::InvalidParameterValueError

Inherits:
RequestParamError show all
Defined in:
lib/request_params_validation/exceptions/validator_errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ InvalidParameterValueError

Returns a new instance of InvalidParameterValueError.



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

def initialize(options)
  @param_key   = options[:param_key]
  @param_value = options[:param_value]
  @param_type  = options[:param_type]
  @details     = options[:details]

  super(message)
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



20
21
22
# File 'lib/request_params_validation/exceptions/validator_errors.rb', line 20

def details
  @details
end

#param_keyObject (readonly)

Returns the value of attribute param_key.



20
21
22
# File 'lib/request_params_validation/exceptions/validator_errors.rb', line 20

def param_key
  @param_key
end

#param_typeObject (readonly)

Returns the value of attribute param_type.



20
21
22
# File 'lib/request_params_validation/exceptions/validator_errors.rb', line 20

def param_type
  @param_type
end

#param_valueObject (readonly)

Returns the value of attribute param_value.



20
21
22
# File 'lib/request_params_validation/exceptions/validator_errors.rb', line 20

def param_value
  @param_value
end

Instance Method Details

#messageObject



31
32
33
34
35
36
37
38
39
# File 'lib/request_params_validation/exceptions/validator_errors.rb', line 31

def message
  message = "The value for the parameter '#{param_key}' is invalid"

  if details.present?
    "#{message}. #{details}"
  else
    message
  end
end