How to catch all uncaught errors in a dart polymer app?

天大地大妈咪最大 提交于 2019-11-29 15:39:24

How about using Window.onError.

import 'dart:html';

main() {
  window.onError.listen((ErrorEvent e) => print(e.message));
  throw 'boom!';
}

So I know we have gotten error handling to work using the following construct:

runZoned(() {
   return initPolymer().run(() => Polymer.onReady
       .then(doSomeStuff)
       .whenComplete(doSomeCompleting));
 },
 onError: (err, [stackTrace]) {
   logger.severe("Received an error", err, stackTrace);
 });

I have posted it in the interest of helping you quickly. I dont have a great explanation off the top of my head why your version isn't working at the moment. Ill do some digging and see if I can work out what is really different.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!