【发布时间】:2016-09-03 16:37:36
【问题描述】:
UPDATE: this is not a problem of code. Code works as it should.
I've restarted OrientDB server for few times and then it works as it should.
So, the problem was in OrientDB server, not the code.
Seems like there is no timeout for promise result. So, when I was calling `db.class.get` the promise was stuck without invocation of `then` or `catch`.
由于一个罕见的巧合,我的问题出现了。代码正常运行。
例如,为什么我在尝试获取类时无法获取回调以捕获错误?
看看这个例子 - http://orientdb.com/docs/master/OrientJS-Class-Classes.html#getting-classes
现在,当我这样做时:
db.class.get('Player')
.then(
function(player){
console.log('Retrieved class: ' + player.name);
}
)
.catch(
function(err){
console.log('Getting class Player error:',err)
}
);
实际上没有记录任何内容。没有错误,没有成功。
这不仅仅是我发现的“虚假”承诺。 我觉得OrientDB的教程太有限了。
那么,如何在上课时发现错误?
【问题讨论】:
-
嗨,我尝试了你的代码,它对我有用,如果存在,我可以获得类,如果不存在,我会得到错误。所以有什么问题?提前谢谢
-
这很奇怪。当我的数据库为
ok时,then函数有效。但是当 db 不是ok时,我的控制台中什么都没有 -catch函数根本没有被调用。当我尝试在server.use上使用then时也出现错误,如教程中所示:TypeError: server.use(...).then is not a function 所以,我不使用then。我们可以私聊吗? -
db not ok 是什么意思?
-
拜托,让我们在这里谈谈 - temp.mexy.pro/#Kmt2OniG8p(无需注册)
标签: promise try-catch orientdb es6-promise