private static Throwable getSmartCause()

in maven-resolver-api/src/main/java/org/eclipse/aether/resolution/ArtifactResolutionException.java [144:172]


    private static Throwable getSmartCause(List<? extends ArtifactResult> results) {
        if (results == null) {
            return null;
        }
        for (ArtifactResult result : results) {
            if (!result.isResolved()) {
                Throwable notFound = null, offline = null;
                for (Throwable t : result.getExceptions()) {
                    if (t instanceof ArtifactNotFoundException) {
                        if (notFound == null || notFound instanceof ArtifactFilteredOutException) {
                            notFound = t;
                        }
                        if (offline == null && t.getCause() instanceof RepositoryOfflineException) {
                            offline = t;
                        }
                    } else {
                        return t;
                    }
                }
                if (offline != null) {
                    return offline;
                }
                if (notFound != null) {
                    return notFound;
                }
            }
        }
        return null;
    }