【发布时间】:2015-10-06 05:05:12
【问题描述】:
在official docs,我看到了这个:
Meteor.call("methodName", function (error) {
// identify the error
if (error.error === "logged-out") {
// show a nice error message
Session.set("errorMessage", "Please log in to post a comment.");
}
});
无论错误消息是什么,我都想在方法中捕获异常。这是这样做的方法吗:
Meteor.call('insertJobLocationData', companyid, jobloc, function (err) {
if (err) {
Session.set("lastErrMsg", "insertJobLocationData failed");
}
?
【问题讨论】:
-
我看不出你在第二个代码块中的内容有什么问题。应该工作