处理meteor客户端的错误

我目前正在使用meteor-collection2而且我的validation系统出现错误。

在“lib”文件夹中,我定义了我的集合,并为其添加了一个SimpleSchema 。 然后,我定义了一个Meteor.method

 # define methods Meteor.methods # create RecipeCommentCreate: (options) -> # find recipe recipe = Recipes.findOne(options.recipeId) if !recipe throw new (Meteor.Error)(404, 'Recipe not found') # init comment comment = message: options.message recipe: _id: recipe._id # insert comment RecipeComments.insert(comment) 

所以,这个代码在client-sideserver-side ,使用延迟补偿(这是完美的,因为collection2可以在双方工作)。

但是,在调用这个方法时(感谢客户端的事件):

 # call method Meteor.call 'RecipeCommentCreate', options, (error, result) -> if error # throw error Errors.throw error.reason else # reset form form.reset() 

这是不正确的,因为callback错误只是服务器端抛出的错误。 客户端的collection2抛出的错误只是使我的浏览器控制台login,并不停止代码:

 [Log] Exception while simulating the effect of invoking 'RecipeCommentCreate' (meteor.js, line 890) 

所以,如果有人能帮我理解我做错了什么
非常感谢,
雅尼斯