开启调试功能时,pouchDB不返回数据

时间:2018-10-08 18:21:57

标签: javascript pouchdb

fileController.js //调用者

   let get = async (identifier) => {  
        //debbug;
        model.init();
        return await model.get(identifier);
    };

函数调用上方:

myFileDatabase.js

this.get = async (id) => {
        if (!this._isValidId(id)){
            return null;
        }
        pimba = await this._db.get(id); //Calling POUCHDB
        return pimba;
    }  

问题是当我调用这些函数in the console it works时。但是,当我尝试使用debbug;并看到pouchDb的返回时,它不会给我任何错误,但不会返回任何错误。

发生了什么

第二次返回return await this._db.get(id); //Calling POUCHDB
该函数永远不会从_db.get(id);返回。它直接返回到调用者。

为什么仅在我的代码上使用debbug;时才会发生这种行为?

我什至尝试使用try{}catch(){}

this.get = async (id) => {
        try{
           if (!this._isValidId(id)){
               return null;
           }
           pimba = await this._db.get(id); //Calling POUCHDB
           return pimba;
        } catch(error) {
           console.log(error);     
        }
    }  

但是它永远不会进入catch

0 个答案:

没有答案