当ember出现问题时,是否有办法获得更清晰的错误消息?
例如,我有这个错误05:10:32,332 Error: Assertion Failed: A helper named 'eq' could not be found1 vendor.self-4fd4ab06f1f66c1cec72e1ec3a2c99328df792e46fb1fdcd0258c341b30a7c3b.js:24472:0
。这个错误不是问题的主题,这只是一个例子。
我不知道eq
在哪里。控制台表明了这个功能:
function EmberError() {
var tmp = Error.apply(this, arguments);
// Adds a `stack` property to the given error object that will yield the
// stack trace at the time captureStackTrace was called.
// When collecting the stack trace all frames above the topmost call
// to this function, including that call, will be left out of the
// stack trace.
// This is useful because we can hide Ember implementation details
// that are not very helpful for the user.
if (Error.captureStackTrace) {
Error.captureStackTrace(this, _emberMetalCore.default.Error);
}
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
for (var idx = 0; idx < errorProps.length; idx++) {
this[errorProps[idx]] = tmp[errorProps[idx]];
}
}
这与我的问题无关。
显然,我在代码中搜索了eq
而我没有结果。我想这是在一个模块中,但使用grep是非常无效的。
有时会有一个堆栈跟踪但它的效率也不高。要在我的代码中使用大vendor.js
或myapp.js
查找插件或来源并不理想。
有更好的解决方案吗?
答案 0 :(得分:0)
我认为您的某个插件或其他第三方代码中的某些内容正在使用ember-truth-helpers addon。
vendor.js
通常包含您导入的第三方代码,而非您编写的代码。
至于基本问题,您需要导入的第三方代码的制造商才能记录其依赖项,并确保在安装该依赖项时安装它们。这真的不是Ember本身的失败,它告诉你没有名为eq
的助手,并且在预编译模板中给出了使用eq
的行号。您可以使用Chrome中的来源标签滚动到vendor.self-4fd4ab06f1f66c1cec72e1ec3a2c99328df792e46fb1fdcd0258c341b30a7c3b.js中的第24472行