PC端 发送消息的失败时的异常处理

lyc 1月前 81

在发送消息失败时,例 敏感词拦截,需要做消息失败所对应的异常处理 在 proto.min.js 发送消息错误后 sendMessage 会返回 errorCode 这个 code 能否加到 message.js 这个类中 避免传 failCallBack 处理多处逻辑

(errorCode) => { //errorCB
                message.status = MessageStatus.SendFailure;
                if (message.conversation.type === ConversationType.ChatRoom) {
                    this.eventEmitter.emit(EventType.MessageStatusUpdate, message);
                }
                if (typeof failCB === 'function') {
                    failCB(errorCode);
                }
            });
最新回复 (2)
  • x86 1月前
    引用 2
    我们不太建议这么来做,还是建议根据回调来获取发送失败的原因,然后做提示或者其他处理

  • x86 1月前
    引用 3
    针对敏感词这种场景,im-server 也支持配置命中时的不同处理策略
返回