Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: pkg/stack_trace/lib/src/chain.dart

Issue 344953002: Properly handle synchronous errors in Chain.capture. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/stack_trace/CHANGELOG.md ('k') | pkg/stack_trace/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/stack_trace/lib/src/chain.dart
diff --git a/pkg/stack_trace/lib/src/chain.dart b/pkg/stack_trace/lib/src/chain.dart
index a097bba343ff0a4bdc21ed4e52a3748fb0df9a9e..78c6ae4014c37c9f7d49d3643f9f3c6ad3648cfa 100644
--- a/pkg/stack_trace/lib/src/chain.dart
+++ b/pkg/stack_trace/lib/src/chain.dart
@@ -90,7 +90,14 @@ class Chain implements StackTrace {
/// [15105]: https://code.google.com/p/dart/issues/detail?id=15105
static capture(callback(), {ChainHandler onError}) {
var spec = new StackZoneSpecification(onError);
- return runZoned(callback, zoneSpecification: spec.toSpec(), zoneValues: {
+ return runZoned(() {
+ try {
+ return callback();
+ } catch (error, stackTrace) {
+ // TODO(nweiz): Don't special-case this when issue 19566 is fixed.
+ return Zone.current.handleUncaughtError(error, stackTrace);
+ }
+ }, zoneSpecification: spec.toSpec(), zoneValues: {
#stack_trace.stack_zone.spec: spec
});
}
« no previous file with comments | « pkg/stack_trace/CHANGELOG.md ('k') | pkg/stack_trace/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698