流星:未捕获错误:必须附加(删除功能)

时间:2016-09-14 12:28:53

标签: javascript meteor uncaught-exception uncaught-typeerror

每次我在Meteor应用程序中删除项目(List)时,控制台都出错。 控制台中的错误是:

  

domrange.js:337未捕获错误:必须附加

这是函数,我无法理解这个错误的来源:

Lists.js

static void Main(string[] args)
        {
            Console.WriteLine("0: " + args[0]);
            //Code to rename the file
            Console.WriteLine("Done. Press enter");
            Console.ReadKey();
        }

一切都在应用程序中正常运行,但您知道这个错误可能来自哪里吗?

Ps:我使用Blaze可以提供帮助

感谢

1 个答案:

答案 0 :(得分:0)

我似乎找到了添加Meteor.isServer或更好的解决方案if(!this.isSimulation)(@MasterAM解决方案):

    'lists.remove'(listId) {
        check(listId, String);

        const list = Lists.findOne(listId);
        if (list.owner !== this.userId) {
            throw new Meteor.Error('not-authorized');
        }
        if (!this.isSimulation) {
            Tasks.remove({"listId": listId});
            Lists.remove(listId);
        }
    },

我在@MasterAM的帮助下编辑了工作代码它现在正在工作!没有控制台错误。