///|
/// Errors raised by this Redis client.
///
/// Server-side Redis errors are reported as `ServerError`. Other variants cover
/// connection setup, transport, response decoding, and client lifecycle misuse.
///
/// Example:
/// ```moonbit nocheck
/// try client.get("key") catch {
///   @redis.ServerError(message) => println(message)
///   @redis.ClientAlreadyWorking => println("client is already running")
///   _ => println("redis client error")
/// } noraise {
///   _ => ()
/// }
/// ```
pub suberror ClientError {
  /// Redis returned an error reply.
  ServerError(String)
  /// The underlying connection or async runtime failed.
  TransportError(Error)
  /// The client could not authenticate, select the database, or finish setup.
  HandshakeError(String)
  /// Redis returned a response shape that did not match the requested command.
  UnexpectedResponse(String)
  /// A response needed to be UTF-8 but was not valid UTF-8.
  InvalidUtf8(Bytes)
  /// A Redis integer did not fit into MoonBit `Int`.
  IntegerOverflow(Int64)
  /// `Client::work` was started while it was already running.
  ClientAlreadyWorking
}