let get = async (identifier) => {
//debbug;
model.init();
return await model.get(identifier);
};
函数调用上方:
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
。