无法在客户端上获取Meteor.Error“详细信息”?

时间:2020-04-21 12:33:55

标签: meteor error-handling

我正在四处搜寻,但仍然没有找到答案。 根据文档Meteor.Error应该被创建:

new Meteor.Error(error, [reason], [details])

我在服务器方法上抛出Meteor.Error,如下所示: 在服务器端:

Meteor.methods({
    async myMethod(userId, curlng = 'en') {
        ...
        throw new Meteor.Error('CODE', 'reason', 'additional details')
    }
})

在客户端:

Meteor.call('myMethod', userId, TAPi18n.getLanguage(), (error, result) => {
     ...
     if (error) {
        console.log(error)
     }
     ...
})

但是我无法收到有关客户的详细信息吗?在客户端console.log中,该字段始终为“未定义”。

是否有办法将一些其他数据放入从服务器发送到客户端的错误中?

0 个答案:

没有答案