String (@Nullable Throwable t) { if (t != null) { String prefix = "\n\nAttachments:\n"; String attachments = ExceptionUtil.findCauseAndSuppressed(t, ExceptionWithAttachments.class).stream() .flatMap(e -> Stream.of(e.getAttachments())) .map(ATTACHMENT_TO_STRING) .collect(Collectors.joining("\n----\n", prefix, "")); if (!attachments.equals(prefix)) { return attachments; } } return ""; }