/** * The chat error class, which contains the error code and error description. */ export class ChatError extends Error { /** * The error code. * * See the error code of the iOS or Android platform: * - iOS: {@link https://docs.agora.io/en/agora-chat/reference/error-codes?platform=ios} * - Android: {@link https://docs.agora.io/en/agora-chat/reference/error-codes?platform=android} */ code: number; /** * The error description. */ description: string; constructor(params: { code: number; description: string }) { super(params.description); if (Object.setPrototypeOf) { Object.setPrototypeOf(this, new.target.prototype); } this.name = 'ChatError'; this.code = params.code; this.description = params.description; } } /** * The chat exception class, which contains the code and description. */ export class ChatException extends ChatError { constructor(params: { code: number; description: string }) { super(params); this.name = 'ChatException'; } }