Class IoExceptionHelper


  • public final class IoExceptionHelper
    extends Object
    Translates exceptions from API calls into higher-level meaning, while allowing injectability for testing how API errors are handled.
    • Method Detail

      • isIoError

        public static boolean isIoError​(Throwable throwable)
        Determines if a given Throwable is caused by an IO error.

        Recursively checks getCause() if outer exception isn't an instance of the correct class.

        Parameters:
        throwable - The Throwable to check.
        Returns:
        True if the Throwable is a result of an IO error.
      • isSocketError

        public static boolean isSocketError​(Throwable throwable)
        Determines if a given Throwable is caused by a socket error.

        Recursively checks getCause() if outer exception isn't an instance of the correct class.

        Parameters:
        throwable - The Throwable to check.
        Returns:
        True if the Throwable is a result of a socket error.
      • isReadTimedOut

        public static boolean isReadTimedOut​(IOException e)
        Determines if a given IOException is caused by a timed out read.
        Parameters:
        e - The IOException to check.
        Returns:
        True if the IOException is a result of a read timeout.