Return server side errors. Shall be overridden by derived forms to add their
        extra errors for AngularJS.
8196
def get_field_errors(self, field):
        
        identifier = format_html('{0}[\'{1}\']', self.form_name, field.name)
        errors = self.errors.get(field.html_name, [])
        return self.error_class([SafeTuple(
            (identifier, self.field_error_css_classes, '$pristine', '$pristine', 'invalid', e)) for e in errors])
555533
function formatRequestErrors(request, errors) {
  const CONTEXT_BEFORE = 20;
  const CONTEXT_LENGTH = 60;

  const queryLines = request.getQueryString().split('\n');
  return errors.map(({locations = [], message}, ii) => {
    const prefix = (ii + 1) + '. ';
    const indent = ' '.repeat(prefix.length);
    return (
      prefix + message + '\n' +
      locations.map(({column, line}) => {
        const queryLine = queryLines[line - 1];
        const offset = Math.min(column - 1, CONTEXT_BEFORE);
        return [
          queryLine.substr(column - 1 - offset, CONTEXT_LENGTH),
          ' '.repeat(offset) + '^^^',
        ].map(messageLine => indent + messageLine).join('\n');
      }).join('\n')
    );
  }).join('\n');
}
1284334
function CartoError (error, opts) {
  opts = opts || {};
  var cartoError = Object.create(Error.prototype);
  cartoError.message = (error && error.message) || UNEXPECTED_ERROR;
  cartoError.origin = (error && error.origin) || GENERIC_ORIGIN;
  cartoError.type = (error && error.type) || '';

  if (_isWindshaftError(error)) {
    cartoError = _transformWindshaftError(error, opts.layers, opts.analysis);
  }

  if (_isAjaxError(error)) {
    cartoError = _transformAjaxError(error);
  }

  // Add extra fields
  var extraFields = errorExtender.getExtraFields(cartoError);
  cartoError.message = extraFields.friendlyMessage;
  cartoError.errorCode = extraFields.errorCode;

  // Final properties
  cartoError.name = 'CartoError';
  cartoError.stack = (new Error()).stack;
  cartoError.originalError = error;

  errorTracker.track(cartoError);

  return cartoError;
}
436464
def form_invalid(self, form, prefix=None):
        
        response = super(FormAjaxMixin, self).form_invalid(form)
        if self.request.is_ajax():
            data = {
                "errors_list": self.add_prefix(form.errors, prefix),
            }
            return self.json_to_response(status=400, json_data=data,
                                         json_status=AjaxResponseStatus.ERROR)
        return response
662835
def http_error(self, url, fp, errcode, errmsg, headers, data=None):
        """"""
        # First check if there's a specific handler for this error
        name = 'http_error_%d' % errcode
        if hasattr(self, name):
            method = getattr(self, name)
            if data is None:
                result = method(url, fp, errcode, errmsg, headers)
            else:
                result = method(url, fp, errcode, errmsg, headers, data)
            if result: return result
        return self.http_error_default(url, fp, errcode, errmsg, headers)
666778
def form_invalid(self, form):
        ''''''
        response = {self.errors_key: {}}
        response[self.non_field_errors_key] = form.non_field_errors()
        response.update(self.get_hidden_fields_errors(form))

        for field in form.visible_fields():
            if field.errors:
                response[self.errors_key][field.html_name] = self._get_field_error_dict(field)

        if self.include_success:
            response[self.sucess_key] = False

        return self._render_json(response)
663460
def errors
      return [] if success?
      @errors ||= Array.wrap(response[:errors]).map do |error|
        ErrorResult.new(error[:error])
      end
    end
1023274
function serializeError(err) {
  var o = {};

  Object.getOwnPropertyNames(err).forEach(function (k) {
    o[k] = err[k];
  });

  return _.omit(o, ['stack', 'type', 'arguments']);
}
610854
def setup_errors(app, error_template="error.html"):
    """"""
    def error_handler(error):
        if isinstance(error, HTTPException):
            description = error.get_description(request.environ)
            code = error.code
            name = error.name
        else:
            description = error
            code = 500
            name = "Internal Server Error"
        return render_template(error_template,
                               error=error,
                               code=code,
                               name=Markup(name),
                               description=Markup(description)), code

    for exception in default_exceptions:
        app.register_error_handler(exception, error_handler)
24299
def render_form_errors(form, error_types="non_field_errors", **kwargs):
    
    renderer_cls = get_form_renderer(**kwargs)
    return renderer_cls(form, **kwargs).render_errors(error_types)
828842
def server_error(request, template_name='500.html'):
    

    response = render_in_page(request, template_name)

    if response:
        return response

    try:
        template = loader.get_template(template_name)
    except TemplateDoesNotExist:
        return http.HttpResponseServerError('<h1>Server Error (500)</h1>', content_type='text/html')
    return http.HttpResponseServerError(template.render(Context({})))
81545
function (req, res, lintErrors) {
  var html = template({
    lintErrors: lintErrors
  });
  res.end(html);
}
618417
function(errors, options) {
      options = options || {};

      var ret = []
        , prettify = options.prettify || v.prettify;
      errors.forEach(function(errorInfo) {
        var error = v.result(errorInfo.error,
            errorInfo.value,
            errorInfo.attribute,
            errorInfo.options,
            errorInfo.attributes,
            errorInfo.globalOptions);

        if (!v.isString(error)) {
          ret.push(errorInfo);
          return;
        }

        if (error[0] === '^') {
          error = error.slice(1);
        } else if (options.fullMessages !== false) {
          error = v.capitalize(prettify(errorInfo.attribute)) + " " + error;
        }
        error = error.replace(/\\\^/g, "^");
        error = v.format(error, {
          value: v.stringifyValue(errorInfo.value, options)
        });
        ret.push(v.extend({}, errorInfo, {error: error}));
      });
      return ret;
    }
228431
function proxyObjErrors (proxyObj) {
  if (!proxyObj) { return '`proxyObj` not defined'; }

  let errors   = '';
  let expected = ['req', 'req', 'reqOpts', 'options'];

  _.each(expected, function (expect, index) {
    if (!proxyObj[expect]) {
      errors += (index ? ', ' : '') + 'Missing property: `' + expect + '`';
    }
  });

  return errors ? 'Errors found in `proxyObj`: [' + errors + ']' : false;
}
232575
function VError(options)
{
	var args, causedBy, ctor, tailmsg;

	if (options instanceof Error || typeof (options) === 'object') {
		args = Array.prototype.slice.call(arguments, 1);
	} else {
		args = Array.prototype.slice.call(arguments, 0);
		options = undefined;
	}

	tailmsg = args.length > 0 ?
	    mod_extsprintf.sprintf.apply(null, args) : '';
	this.jse_shortmsg = tailmsg;
	this.jse_summary = tailmsg;

	if (options) {
		causedBy = options.cause;

		if (!causedBy || !(options.cause instanceof Error))
			causedBy = options;

		if (causedBy && (causedBy instanceof Error)) {
			this.jse_cause = causedBy;
			this.jse_summary += ': ' + causedBy.message;
		}
	}

	this.message = this.jse_summary;
	Error.call(this, this.jse_summary);

	if (Error.captureStackTrace) {
		ctor = options ? options.constructorOpt : undefined;
		ctor = ctor || arguments.callee;
		Error.captureStackTrace(this, ctor);
	}
}
797732
function errors() {
        // handling 404 errors from config.express['404_redirect'] property
        if (config['404_redirect']) {
            server.use(function (req, res, next) {
                res.status(302)
                res.writeHead(302, { 'Location': config['404_redirect'] })
                res.end()
            })
        } else {
            server.use(function (req, res, next) {
                res.status(404).send({ message: 'not found' })
            })
        }

        if (errorHandlers.length) {
            for (let eh of errorHandlers) {
                server.use(wrapper(eh))
            }
        }

        //Default error handler
        server.use((err, req, res, next) => {
            if (!config.silent && !errorHandlers.length)
                app.drivers.logger.error('Unhandled server error', err)
            res.status(500)
               .json({
                   message: err.message,
                   stack: process.env.NODE_ENV === 'production' ? undefined : err.stack
               })
        })
    }
475359
def pretty_print_error(err_json):
    """"""
    # Special case validation errors
    if len(err_json) == 1 and "validationOf" in err_json[0]:
        required_fields = ", ".join(err_json[0]["validationOf"]["required"])
        return "Validation error. Requires properties: {}.".format(required_fields)

    # General error handling
    msg = "; ".join(err.get("message", "") for err in err_json)

    # Fallback
    if not msg:
        msg = "Bad request."
    return msg