All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.kickstart.spring.error.Throwables Maven / Gradle / Ivy

There is a newer version: 15.1.0
Show newest version
package graphql.kickstart.spring.error;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;

class Throwables {

  private List> exceptions;

  Throwables(Class[] exceptions) {
    this.exceptions = Arrays.asList(exceptions);
  }

  Optional> mostConcrete(Throwable throwable) {
    return exceptions.stream()
        .filter(t -> t.isAssignableFrom(throwable.getClass()))
        .min(new ThrowableComparator());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy