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.



411
412
413
414
# File 'lib/jsonapi/exceptions.rb', line 411

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

Instance Attribute Details

#paramObject

Returns the value of attribute param.



409
410
411
# File 'lib/jsonapi/exceptions.rb', line 409

def param
  @param
end

Instance Method Details

#errorsObject



416
417
418
419
420
421
422
423
# File 'lib/jsonapi/exceptions.rb', line 416

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