"捕捉不是一种功能"例外

时间:2017-08-21 14:53:09

标签: javascript jquery exception

我在运行jQuery 3.1.1(或3.2.1)的JBoss(6.4.14 GA)上遇到了问题。一旦页面加载并执行documet.ready函数,我就会收到以下错误:

  

jquery.js:格式化:8142未捕获TypeError:aj.then(...)。捕获不是函数
          at bw.fn.init.bw.fn.ready(jquery.js:formatted:8142)
          在srs.js:1

抛出此错误的jQuery代码是:

var readyList = jQuery.Deferred();

jQuery.fn.ready = function( fn ) {

    readyList
        .then( fn )

        // Wrap jQuery.readyException in a function so that the lookup
        // happens at the time of error handling instead of callback
        // registration.
        .catching( function( error ) {
            jQuery.readyException( error );
        } );

    return this;
};

在Tomcat 7上运行我的应用程序时,我没有收到此错误。

我已经研究了这个错误好几天了,而且找不到任何对这个特定错误的引用(捕获不是函数),所以在确定这个错误的原因时寻找一些帮助。

提前致谢!

1 个答案:

答案 0 :(得分:0)

catching 不是 jquery推迟的方法,您可能正在寻找catch

出于调试目的,您可以使用Object.getOwnPropertyNames列出对象的属性,并查看它们具有哪个。在您的情况下,执行下面的代码可以帮助您找到错误:

var debugValue = aj.then(bS)
console.log(Object.getOwnPropertyNames(debugValue))