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

com.bandwidth.sdk.messaging.exception.ExceptionUtils Maven / Gradle / Ivy

package com.bandwidth.sdk.messaging.exception;

import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;

public class ExceptionUtils {

    public static  CompletableFuture catchAsyncClientExceptions(Callable> callable) {
        try {
            return callable.call();
        } catch (Throwable e) {
            CompletableFuture future = new CompletableFuture<>();
            future.completeExceptionally(new MessagingClientException(e));
            return future;
        }
    }

    public static  T catchClientExceptions(Callable callable) {
        try {
            return callable.call();
        } catch (Throwable e) {
            throw new MessagingClientException(e);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy