本文介绍了如何在Dart中获取Completer.CompleteException(exception,stackTrace);的当前堆栈跟踪;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果某些代码返回了将来,并确定将来应返回错误或异常,则如何将堆栈跟踪传递给 Completer.completeException(exception,stackTrace);

If some code returns a future and determines that the future should return "Error" or "Exception" how can a stack trace be passed to Completer.completeException(exception, stackTrace);

推荐答案

如果我正确理解:当您在dart中捕获异常时,还可以捕获堆栈跟踪: / p>

If I understand correctly: when you catch an exception in dart, you can also catch the stack trace:

try {
  // something
} catch(e, stacktrace) {
  myCompleter.completeException(e, stacktrace);
}

这篇关于如何在Dart中获取Completer.CompleteException(exception,stackTrace);的当前堆栈跟踪;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 09:19
查看更多