Class StreamException

java.lang.Object
java.lang.Throwable
java.lang.Exception
io.getstream.exceptions.StreamException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
StreamApiException, StreamTaskException, StreamTransportException, Webhook.InvalidWebhookError

public class StreamException extends Exception
See Also:
  • Constructor Details

  • Method Details

    • build

      public static StreamException build(String issue)
      Builds a StreamException to signal an issue
      Parameters:
      issue - the issue
      Returns:
      the StreamException
    • build

      public static StreamException build(okhttp3.ResponseBody responseBody)
      Builds a typed API exception from the Stream API error body.

      Parseable APIError envelope → StreamApiException; unparseable body but HTTP layer succeeded → StreamApiException with code=0 and the raw body preserved.

      This overload does not see the status code; callers that have a Response should prefer build(Response) so 429 is routed to StreamRateLimitException and statusCode is preserved.

    • build

      public static StreamException build(okhttp3.Response httpResponse)
      Builds a typed API exception from an HTTP response. 429 → StreamRateLimitException with Retry-After parsed per RFC 7231 §7.1.3 (integer seconds or HTTP-date). Other 4xx/5xx → StreamApiException.
    • build

      public static StreamException build(Throwable t)
      Builds a StreamException when an exception occurs calling the API.

      Historic factory preserved for back-compat. The HTTP-call path now classifies transport failures directly via StreamTransportException.fromIOException(IOException) so this factory no longer auto-routes; it simply wraps the cause.

      Parameters:
      t - the underlying exception
      Returns:
      the StreamException