Exception: JSONAPI::Exceptions::BadRequest

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

Instance Attribute Summary

Attributes inherited from Error

#error_object_overrides

Instance Method Summary collapse

Methods inherited from Error

#create_error_object

Constructor Details

#initialize(exception, error_object_overrides = {}) ⇒ BadRequest

Returns a new instance of BadRequest.



145
146
147
148
# File 'lib/jsonapi/exceptions.rb', line 145

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

Instance Method Details

#errorsObject



150
151
152
153
154
155
156
157
# File 'lib/jsonapi/exceptions.rb', line 150

def errors
  [create_error_object(code: JSONAPI::BAD_REQUEST,
                       status: :bad_request,
                       title: I18n.translate('jsonapi-resources.exceptions.bad_request.title',
                                             default: 'Bad Request'),
                       detail: I18n.translate('jsonapi-resources.exceptions.bad_request.detail',
                                              default: @exception))]
end