我刚看了最近与ember-core框架开发人员讨论的video。
在视频中,小组成员被要求分享一个一般的调试提示--Tom Dale调用了RSVP onerror处理程序,这使得全局报告异常,否则这些异常会在没有拒绝处理程序的情况下被承诺。
我认为这个处理程序会回答我在Stack Overflow上其他地方问过的(有点混乱)问题。有谁知道如何使用这个处理程序或它的文档可能是什么?
答案 0 :(得分:4)
文档在这里:https://github.com/tildeio/rsvp.js#error-handling
这是在2013年9月左右增加的。
答案 1 :(得分:3)
希望这可以帮助任何其他人更多地想要Ember错误并使用已转换的Ember代码进行调试。
首先安装:https://github.com/evanw/node-source-map-support
然后 -
模板:
{{#if debug}}
<script src="/browser-source-map-support.js"></script>
<script>sourceMapSupport.install();</script>
{{/if}}
<script src="/bundle-{{ version }}.js"></script>
脚本:
Ember.onerror = function (e) {
if(debug) {
console.log(window.sourceMapSupport.getErrorSource(e));
console.log(e.stack);
}
// log error to server
};
Ember.RSVP.configure('onerror', function (e) {
if(debug) {
console.log(window.sourceMapSupport.getErrorSource(e));
console.log(e.stack);
}
// log error to server
});
调试更容易,更快捷。