code: def wrap_error(
              self, data, renderer_context, keys_are_fields, issue_is_title):
          
  
          response = renderer_context.get("response", None)
          status_code = str(response and response.status_code)
  
          errors = []
          for field, issues in data.items():
              if isinstance(issues, six.string_types):
                  issues = [issues]
              for issue in issues:
                  error = self.dict_class()
                  error["status"] = status_code
  
                  if issue_is_title:
                      error["title"] = issue
                  else:
                      error["detail"] = issue
  
                  if keys_are_fields:
                      if field in ('non_field_errors', NON_FIELD_ERRORS):
                          error["path"] = '/-'
                      else:
                          error["path"] = '/' + field
  
                  errors.append(error)
          wrapper = self.dict_class()
          wrapper["errors"] = errors
          return wrapper
docs: Convert error native data to the JSON API Error format
  
          JSON API has a different format for errors, but Django REST Framework
          doesn't have a separate rendering path for errors.  This results in
          some guesswork to determine if data is an error, what kind, and how
          to handle it.
  
          As of August 2014, there is not a consensus about the error format in
          JSON API.  The format documentation defines an "errors" collection, and
          some possible fields for that collection, but without examples for
          common cases.  If and when consensus is reached, this format will
          probably change.