module JsonapiActions::ErrorHandling

Public Instance Methods

bad_request(error) click to toggle source
# File lib/jsonapi_actions/error_handling.rb, line 11
def bad_request(error)
  render json: { errors: [{ status: 400, title: 'Bad Request', detail: error.message }] }, status: :bad_request
end
record_not_found(error) click to toggle source
# File lib/jsonapi_actions/error_handling.rb, line 15
def record_not_found(error)
  render json: { errors: [{ status: 404, title: 'Not Found', detail: error.message }] }, status: :not_found
end
user_not_authorized(error) click to toggle source
# File lib/jsonapi_actions/error_handling.rb, line 19
def user_not_authorized(error)
  render json: { errors: [{ status: 403, title: 'Forbidden', detail: error.message }] }, status: :forbidden
end