public static <T> T parse(String value, Function<String, T> parser, String description) {
        try {
            return parser.apply(requireNonNull(value, description + " cannot be null"));
        }
        catch (RuntimeException e) {
            throw new IllegalArgumentException("failed parsing " + description +
                                               " '" + value + "': " + Exceptions.toMessageString(e));
        }
    }
Parses and returns the given string, or throws an exception with some context in the message.
vespajlib/src/main/java/ai/vespa/validation/Validation.java