public static Supplier<NoSuchElementException> newNoSuchElementExceptionFor(
        Document document,
        String key) {

        return () -> new NoSuchElementException(
            "An attribute with the key '" + key
            + "' could not be found in " + document
            + " with name (" + Optional.ofNullable(document)
            .flatMap(doc -> doc.getAsString("name"))
            .orElse("null")
            + ")"
        );
    }
Returns an {@code Exception} supplier for when no attribute could be
found on a specified key in a specified document.

@param document the document
@param key      the key
@return         the {@code Exception} supplier
runtime-parent/runtime-config/src/main/java/com/speedment/runtime/config/util/DocumentUtil.java