Class ChatErrorKt
-
- All Implemented Interfaces:
public final class ChatErrorKt
-
-
Method Summary
Modifier and Type Method Description final static Error.NetworkErrorfromChatErrorCode(Error.NetworkError.Companion $self, ChatErrorCode chatErrorCode, Integer statusCode, Throwable cause)Creates Error.NetworkError from ChatErrorCode with custom status code and optional cause. final static BooleanisPermanent(Error $self)Returns true if an error is a permanent failure instead of a temporary one (broken network, 500, rate limit etc. final static ErrorcopyWithMessage(Error $self, String message)Copies the original Error objects with custom message. final static ThrowableextractCause(Error $self)Extracts the cause from Error object or null if it's not available. -
-
Method Detail
-
fromChatErrorCode
final static Error.NetworkError fromChatErrorCode(Error.NetworkError.Companion $self, ChatErrorCode chatErrorCode, Integer statusCode, Throwable cause)
Creates Error.NetworkError from ChatErrorCode with custom status code and optional cause.
- Parameters:
chatErrorCode- The ChatErrorCode from which the error should be created.statusCode- HTTP status code or UNKNOWN_STATUS_CODE if not available.cause- The optional Throwable associated with the error.
-
isPermanent
final static Boolean isPermanent(Error $self)
Returns true if an error is a permanent failure instead of a temporary one (broken network, 500, rate limit etc.)
A permanent error is an error returned by Stream's API (IE a validation error on the input) Any permanent error will always have a stream error code
Temporary errors are retried. Network not being available is a common example of a temporary error.
See the error codes here https://getstream.io/chat/docs/api_errors_response/?language=js
-
copyWithMessage
final static Error copyWithMessage(Error $self, String message)
Copies the original Error objects with custom message.
- Parameters:
message- The message to replace.
-
extractCause
final static Throwable extractCause(Error $self)
Extracts the cause from Error object or null if it's not available.
-
-
-
-