com.oembedler.moon.graphql.boot.error.Throwables Maven / Gradle / Ivy
package com.oembedler.moon.graphql.boot.error;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
class Throwables {
private List> throwables;
Throwables(Class extends Throwable>[] throwables) {
this.throwables = Arrays.asList(throwables);
}
Optional> mostConcrete(Throwable throwable) {
return throwables.stream()
.filter(t -> t.isAssignableFrom(throwable.getClass()))
.min(new ThrowableComparator());
}
}