Exception: JSONAPI::Exceptions::ParameterMissing

Inherits:
Error
  • Object
show all
Defined in:
lib/jsonapi/exceptions.rb

Instance Attribute Summary collapse

Attributes inherited from Error

#error_object_overrides

Instance Method Summary collapse

Methods inherited from Error

#create_error_object

Constructor Details

#initialize(param, error_object_overrides = {}) ⇒ ParameterMissing

Returns a new instance of ParameterMissing.



391
392
393
394
# File 'lib/jsonapi/exceptions.rb', line 391

def initialize(param, error_object_overrides = {})
  @param = param
  super(error_object_overrides)
end

Instance Attribute Details

#paramObject

Returns the value of attribute param.



389
390
391
# File 'lib/jsonapi/exceptions.rb', line 389

def param
  @param
end

Instance Method Details

#errorsObject



396
397
398
399
400
401
402
403
# File 'lib/jsonapi/exceptions.rb', line 396

def errors
  [create_error_object(code: JSONAPI::PARAM_MISSING,
                       status: :bad_request,
                       title: I18n.translate('jsonapi-resources.exceptions.parameter_missing.title',
                                             default: 'Missing Parameter'),
                       detail: I18n.translate('jsonapi-resources.exceptions.parameter_missing.detail',
                                              default: "The required parameter, #{param}, is missing.", param: param))]
end