Format this error into a JSON response.

    Args:
      error_list_tag: A string specifying the name of the tag to use for the
        error list.

    Returns:
      A dict containing the reformatted JSON error response.
4419
def __format_error(self, error_list_tag):
    
    error = {'domain': self.domain(),
             'reason': self.reason(),
             'message': self.message()}
    error.update(self.extra_fields() or {})
    return {'error': {error_list_tag: [error],
                      'code': self.status_code(),
                      'message': self.message()}}
909792
def tag(self, tag):
        
        url = '%s/tags/%s' % (self, tag)
        response = self.http.get(url, auth=self.auth)
        response.raise_for_status()
        return response.json()
1159237
def format_errors(self, errors, many):
        """"""
        if not errors:
            return {}
        if isinstance(errors, (list, tuple)):
            return {'errors': errors}

        formatted_errors = []
        if many:
            for index, errors in iteritems(errors):
                for field_name, field_errors in iteritems(errors):
                    formatted_errors.extend([
                        self.format_error(field_name, message, index=index)
                        for message in field_errors
                    ])
        else:
            for field_name, field_errors in iteritems(errors):
                formatted_errors.extend([
                    self.format_error(field_name, message)
                    for message in field_errors
                ])
        return {'errors': formatted_errors}
1106753
def transform_error2_response(error)
        response = ["#{error.message}: #{error.http_body}", error.http_code]
        def response.body
          self[0]
        end
        def response.code
          self[1]
        end
        response
      end
1300561
def api_errors_to_messages(request, error, fallback_text):
    
    try:
        response_body = json.loads(error.content.decode('utf-8'))
        for field, errors in response_body.items():
            if isinstance(errors, list):
                for error in errors:
                    messages.error(request, error)
            else:
                messages.error(request, errors)
    except (AttributeError, ValueError, KeyError):
        messages.error(request, fallback_text)
970997
function(errors) {
      var ret = {};
      errors.forEach(function(error) {
        var list = ret[error.attribute];
        if (list) {
          list.push(error);
        } else {
          ret[error.attribute] = [error];
        }
      });
      return ret;
    }
312016
def format_error(self, field_name, message, index=None):
        
        pointer = ['/data']

        if index is not None:
            pointer.append(str(index))

        relationship = isinstance(
            self.declared_fields.get(field_name), BaseRelationship,
        )
        if relationship:
            pointer.append('relationships')
        elif field_name != 'id':
            # JSONAPI identifier is a special field that exists above the attribute object.
            pointer.append('attributes')

        pointer.append(self.inflect(field_name))

        if relationship:
            pointer.append('data')

        return {
            'detail': message,
            'source': {
                'pointer': '/'.join(pointer),
            },
        }
568886
def err_response(reqid, code, msg, data=None):
    
    err = { "code": code, "message": msg }
    if data:
        err["data"] = data
    return { "jsonrpc": "2.0", "id": reqid, "error": err }
398820
def json_error_response(error, response, status_code=400):
    
    msg = {"error": error.error, "error_description": error.explanation}

    response.status_code = status_code
    response.add_header("Content-Type", "application/json")
    response.body = json.dumps(msg)

    return response
34789
def error_wrapping(html_tag, has_error)
      has_error ? ActionView::Base.field_error_proc.call(html_tag, self) : html_tag
    end
329514
def data(self):
        
        res = {'error_list': self.error_list}
        res.update(super(ValidationErrors, self).data)
        return res
1320332
def json_error_handler(exception):
    
    http_exception = isinstance(exception, exceptions.HTTPException)
    code = exception.code if http_exception else 500

    # log exceptions only (app debug should be off)
    if code == 500:
        current_app.logger.error(exception)

    response = jsonify(dict(message=str(exception)))
    response.status_code = code
    return response
789416
function errorJSON (err) {
  var res = {}
  Object.getOwnPropertyNames(err).forEach(function (key) {
    res[key] = err[key]
  }, err)
  return res
}
389193
def get_error(self, error):
        
        error_type = type(error)
        if error.error_type == ET_CLIENT:
            error_type_name = 'Client'
        else:
            error_type_name = 'Server'
        return {
            'type': error_type_name,
            'name': error_type.__name__,
            'prefix': getattr(error_type, '__module__', ''),
            'message': unicode(error),
            'params': error.args,
        }
1346848
def errcat(self):
        '''
        
        '''
        post_recs = MPost.query_random(limit=1000)
        outrecs = []
        errrecs = []
        idx = 0
        for postinfo in post_recs:
            if idx > 16:
                break
            cat = MPost2Catalog.get_first_category(postinfo.uid)
            if cat:
                if 'def_cat_uid' in postinfo.extinfo:
                    if postinfo.extinfo['def_cat_uid'] == cat.tag_id:
                        pass
                    else:
                        errrecs.append(postinfo)
                        idx += 1
                else:
                    errrecs.append(postinfo)
                    idx += 1
            else:
                outrecs.append(postinfo)
                idx += 1
        self.render('list/errcat.html',
                    kwd={},
                    norecs=outrecs,
                    errrecs=errrecs,
                    userinfo=self.userinfo)
1256061
def _get_errors(self):
        
        errors = self.json.get('data').get('failures')
        if errors:
            logger.error(errors)
        return errors
760696
def error_response(message, status=400, code=None):
    """""""
    from django.http import JsonResponse
    data = {'message': message}
    if code:
        data['code'] = code
    LOG.error("Error response, status code is : {} | {}".format(status, data))
    return JsonResponse(data=data, status=status)