public Exception decode()

in src/main/java/org/apache/fineract/cn/api/util/AnnotatedErrorDecoder.java [53:66]


  public Exception decode(
      final String methodKey,
      final Response response) {
    final Optional<Exception> ret =
        Arrays.stream(feignClientClass.getMethods())
            .filter(method -> Feign.configKey(feignClientClass, method).equals(methodKey))
            .map(method -> {
              final Optional<ThrowsException> annotation = getMatchingAnnotation(response, method);
              return annotation.flatMap(a -> constructException(response, a));
            })
            .findAny().flatMap(x -> x);

    return ret.orElse(getAlternative(methodKey, response));
  }