Pretty prints the given parse error showing its location in the given input buffer.

@param error       the parse error
@param formatter   the formatter for InvalidInputErrors
@return the pretty print text
174379
public static String printParseError(ParseError error, Formatter<InvalidInputError> formatter) {
        checkArgNotNull(error, "error");
        checkArgNotNull(formatter, "formatter");
        String message = error.getErrorMessage() != null ? error.getErrorMessage() :
                error instanceof InvalidInputError ?
                        formatter.format((InvalidInputError) error) : error.getClass().getSimpleName();
        return printErrorMessage("%s (line %s, pos %s):", message,
                error.getStartIndex(), error.getEndIndex(), error.getInputBuffer());
    }
844169
@SuppressWarnings("checkstyle:regexp")
	public static void showError(String message, Throwable exception) {
		try (PrintWriter logger = new PrintWriter(getConsoleLogger())) {
			if (message != null && !message.isEmpty()) {
				logger.println(message);
			} else if (exception != null) {
				exception.printStackTrace(logger);
			}
			logger.println();
			logger.flush();
			showHelp(logger, false);
			showVersion(true);
		}
	}
611764
def format_error(module, error):
    """"""
    logging.error(module)
    # Beautify JSON error
    print error.message
    print json.dumps(error.error, sort_keys=True, indent=4, separators=(',', ': '))
    exit(1)
954316
function throwError(messageFormat) {
        var args, msg;

        args = Array.prototype.slice.call(arguments, 1);
        msg = messageFormat.replace(/%(\d)/g,
            function (whole, idx) {
                assert(idx < args.length, 'Message reference must be in range');
                return args[idx];
            }
        );

        throw createError(lastLineNumber, lastIndex, msg);
    }
1043299
public static void error(final Logger logger, final String format, final Object... params) {
		error(logger, format, null, params);
	}
1242941
private String getParserErrorMessage() {
	StringBuffer code = new StringBuffer(text);
	code = code.insert(maxPosition, " >><< ");
	String codeString = code.substring(maxPosition - 100 < 0 ? 0 : maxPosition - 100,
		maxPosition + 100 >= code.length() ? code.length() : maxPosition + 100);
	return "Could not parse the input string near '" + codeString + "'!";
    }
305683
protected String handleError(final String message) {
        notifier().error(formatMessage(message));
        return formatMessage(message);
    }
1238592
function formatError(err, input) {
    var msg = err.message.replace(/\s*\(\d*\:\d*\)\s*$/i, ''); // remove line number / col number

    var bm = ('' + input.slice(0, err.pos)).match(/.*$/i);
    var am = ('' + input.slice(err.pos)).match(/.*/i);
    var before = bm ? bm[0] : '';
    var after = am ? am[0] : '';

    // Prepare line info for txt display
    var cursorPos = before.length;
    var lineStr = before + after;
    var lncursor = [];
    for (var i = 0, sz = lineStr.length; sz > i; i++) {
        lncursor[i] = (i === cursorPos) ? '\u005E' : '-';
    }
    var lineInfoTxt = lineStr + '\n' + lncursor.join('');

    return {
        description: msg,
        lineInfoTxt: lineInfoTxt,
        code: lineStr,
        line: err.loc ? err.loc.line : -1,
        column: err.loc ? err.loc.column : -1
    };
}
1336022
public static <T extends GraphNode<T>> String printTree(T node, Formatter<T> formatter) {
        checkArgNotNull(formatter, "formatter");
        return printTree(node, formatter, Predicates.<T>alwaysTrue(), Predicates.<T>alwaysTrue());
    }
1086136
@FormatMethod
  private void reportError(ParseTree parseTree, @FormatString String message, Object... arguments) {
    if (parseTree == null) {
      reportError(message, arguments);
    } else {
      errorReporter.reportError(parseTree.location.start, message, arguments);
    }
  }
624529
def format_error(error):
    """"""
    formatted = {"message": str(error)}

    if hasattr(error, "traceback"):
        fname, line_no, func, exc = error.traceback
        formatted.update({
            "fname": fname,
            "line_number": line_no,
            "func": func,
            "exc": exc
        })

    return formatted
723380
public static <T extends Errors> T parseError(ObjectMapper mapper, JsonNode errorResponse, Class<T> cls) throws JsonProcessingException {
        return mapper.treeToValue(errorResponse, cls);
    }
701404
protected void showError(String error) {

        if (null == error) {
            m_errorLabel.setText("");
        } else {
            m_errorLabel.setText(error);
        }
    }
803341
function formatWebErrors(errors) {
    let errs = {};
    if (errors && errors.constructor == Array) {
        errors.forEach(function(item) {
            if (!errs[item.param]) errs[item.param] = [];
            errs[item.param].push(item.msg);
        });
    }
    return errs;
}
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
81846
def format_error(err_type, err_value, err_trace=None):
    """"""
    if err_trace is None:
        err_parts = "".join(traceback.format_exception_only(err_type, err_value)).strip().split(": ", 1)
        if len(err_parts) == 1:
            err_name, err_msg = err_parts[0], ""
        else:
            err_name, err_msg = err_parts
        err_name = err_name.split(".")[-1]
        return err_name + ": " + err_msg
    else:
        return "".join(traceback.format_exception(err_type, err_value, err_trace)).strip()
39870
protected void printError(final String id, final Span references[],
      final Span predictions[], final T referenceSample,
      final T predictedSample, final String[] sentenceTokens) {
    final List<Span> falseNegatives = new ArrayList<Span>();
    final List<Span> falsePositives = new ArrayList<Span>();

    findErrors(references, predictions, falseNegatives, falsePositives);

    if (falsePositives.size() + falseNegatives.size() > 0) {

      if (id != null) {
        this.printStream.println("Id: {" + id + "}");
      }

      printSamples(referenceSample, predictedSample);

      printErrors(falsePositives, falseNegatives, sentenceTokens);

    }
  }