【问题标题】:Resolve Twilio "Uncaught (in promise) t: Error while setting LastConsumedMessageIndex" error message解决 Twilio “Uncaught (in promise) t: Error while setting LastConsumedMessageIndex”错误消息
【发布时间】:2020-05-13 10:03:18
【问题描述】:

在 Wraupup 聊天任务之后,当我从 Twilio Chat API 添加消息时,我收到“Uncaught (in promise) t: Error while setting LastConsumedMessageIndex”错误消息。如果代理在单击 Wraupup 任务按钮后立即单击 Twilio Flex 中的完成任务,则此错误消息将显示在浏览器控制台中。

我发现此错误是由 Twilio JS SDK 中的 sessionerror.js 文件生成的。我无法更改该文件的源代码。如何从我的自定义代码中覆盖它?

这是我在 sessionerror.js 文件中找到的代码:

var SessionError = function (_extendableBuiltin2) {
    (0, _inherits3.default)(SessionError, _extendableBuiltin2);

    function SessionError(message, code) {
        (0, _classCallCheck3.default)(this, SessionError);

        var _this = (0, _possibleConstructorReturn3.default)(this, (SessionError.__proto__ || (0, _getPrototypeOf2.default)(SessionError)).call(this));

        _this.name = _this.constructor.name;
        _this.message = message;
        _this.code = code;
        if (Error.captureStackTrace) {
            Error.captureStackTrace(_this, _this.constructor);
        } else {
            _this.stack = new Error().stack;
        }
        return _this;
    }

    return SessionError;
}(_extendableBuiltin(Error));

exports.SessionError = SessionError;

我怎样才能覆盖它?

【问题讨论】:

    标签: javascript reactjs error-handling twilio twilio-programmable-chat


    【解决方案1】:

    我刚刚通过使用 unhandledrejection 事件监听器解决了我的问题。

    使用了以下sn-ps:

    window.addEventListener('unhandledrejection', function (event) {
      // ...your code here to handle the unhandled rejection...
    
      // Prevent the default handling (such as outputting the
      // error to the console)
    
      event.preventDefault();
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-29
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-02
      • 1970-01-01
      相关资源
      最近更新 更多