Interface RequestResult

  • All Implemented Interfaces:

    
    public interface RequestResult<T extends Object, E extends BadRequestError>
    
                        

    High-level result type for chat server requests.

    This sealed interface represents all possible outcomes from network requests:

    • Success: The request completed successfully with a result

    • NonSuccess: The request reached the server but returned a business logic error

    • RetryableNetworkError: A network failure occurred; the request may succeed if retried

    • ApplicationError: A client-side bug prevented request completion

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public final class RequestResult.Success

      The request completed successfully and produced a result.

      public final class RequestResult.NonSuccess

      We successfully made the request, but the server returned an error.

      This represents expected error conditions defined by the API, such as "invalid authorization" or "outdated recipient information". These errors are part of the API contract and should be handled explicitly by callers.

      public final class RequestResult.RetryableNetworkError

      A retryable network failure occurred before receiving a response.

      This includes connection failures, timeouts, server errors, and rate limiting. Callers may retry these requests, optionally after a delay.

      Possible types for networkError include but are not limited to:

      • TimeoutException: occurs when the request takes too long to complete.

      • ConnectedElsewhereException: occurs when a client connects elsewhere with same credentials before the request could complete

      • ConnectionInvalidatedException: occurs when the connection to the server is invalidated (e.g. the account is deleted) before the request could complete

      • RetryLaterException: occurs when the client hits a rate limit, and must wait at least the duration specified before retrying. retryAfter will always be set with this error

      • TransportFailureException: occurs when the transport layer fails

      • ServerSideErrorException: occurs when the server returns a response indicating a server-side error occurred. You may wish to retry with an especially long timeout on critical paths, like message sending, to avoid worsening a server outage.

      public final class RequestResult.ApplicationError

      A client-side issue prevented the request from completing.

      This likely indicates a bug in libsignal.

      Possible types for cause include but are not limited to:

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      <R extends Any> RequestResult<R, E> map(Function1<T, R> transform)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait