UNPKG

@ably/chat

Version:

Ably Chat is a set of purpose-built APIs for a host of chat features enabling you to create 1:1, 1:Many, Many:1 and Many:Many chat rooms for any scale. It is designed to meet a wide range of chat use cases, such as livestreams, in-game communication, cust

63 lines (51 loc) 1.59 kB
import * as Ably from 'ably'; /** * Error codes for the Chat SDK. */ export enum ErrorCode { /** * The request was invalid. */ BadRequest = 40000, /** * The message was rejected before publishing by a rule on the chat room. */ MessageRejectedByBeforePublishRule = 42211, /** * The message was rejected before publishing by a moderation rule on the chat room. */ MessageRejectedByModeration = 42213, /** * Could not re-enter presence automatically after a room re-attach occurred. */ PresenceAutoReentryFailed = 91004, /** * The room has experienced a discontinuity. */ RoomDiscontinuity = 102100, // Unable to perform operation; /** * Cannot perform operation because the room is in a failed state. */ RoomInFailedState = 102101, /** * Cannot perform operation because the room is in a releasing state. */ RoomIsReleasing = 102102, /** * Cannot perform operation because the room is in a released state. */ RoomIsReleased = 102103, /** * Room was released before the operation could complete. */ RoomReleasedBeforeOperationCompleted = 102106, } /** * Returns true if the {@link Ably.ErrorInfo} code matches the provided ErrorCode value. * @param errorInfo The error info to check. * @param error The error code to compare against. * @returns true if the error code matches, false otherwise. */ // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison export const errorInfoIs = (errorInfo: Ably.ErrorInfo, error: ErrorCode): boolean => errorInfo.code === error;