Errors
Every error extends SocketError and carries a stable code plus the
eventId it belongs to.
| Class | Code | Raised when |
|---|---|---|
SocketValidationError | ERR_SOCKET_VALIDATION | A frame fails its schema. phase is "request", "ack" or "payload"; issues holds the Zod issues. |
SocketAckTimeoutError | ERR_SOCKET_ACK_TIMEOUT | No acknowledgement arrived in time. |
SocketNotConnectedError | ERR_SOCKET_NOT_CONNECTED | An emit was attempted with no live connection. |
SocketWaitTimeoutError | ERR_SOCKET_WAIT_TIMEOUT | .wait() expired. |
SocketOverrideError | ERR_SOCKET_OVERRIDE | An instrumentation override forced a failure. |
import { SocketValidationError } from "@tahanabavi/typesocket";
try {
await client.modules.chat.sendMessage({ roomId: "r1", text: "" });
} catch (error) {
if (error instanceof SocketValidationError) console.error(error.issues);
}