private void mergeAllReplyErrors(Reply r) {
        if (handleReplyWithOnlyIgnoredErrors(r)) {
            return;
        }
        if (error == null) {
            error = r;
        }
        else if (mostSevereErrorCode(r) > mostSevereErrorCode(error)) {
            error.getErrors().forEach(r::addError);
            error = r;
        }
        else {
            r.getErrors().forEach(error::addError);
        }
    }
Encapsulated logic for merging replies from 1-n related DocumentProtocol messages.
For internal use only. Not multithread safe.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/ReplyMerger.java