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

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

Issue 232123003: Properly handle errors thrown in [Chain.capture]'s [onError] handler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « no previous file | pkg/stack_trace/test/chain_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/stack_trace/lib/src/stack_zone_specification.dart
diff --git a/pkg/stack_trace/lib/src/stack_zone_specification.dart b/pkg/stack_trace/lib/src/stack_zone_specification.dart
index 36e0717d2ce7d18eaea9d8aa3a3a6475fa55602f..9a4f7c05af10f18893f1d9f0b0acb8b55fd0318b 100644
--- a/pkg/stack_trace/lib/src/stack_zone_specification.dart
+++ b/pkg/stack_trace/lib/src/stack_zone_specification.dart
@@ -145,10 +145,21 @@ class StackZoneSpecification {
/// [_onError] or [parent]'s error handler.
handleUncaughtError(Zone self, ZoneDelegate parent, Zone zone, error,
StackTrace stackTrace) {
+ var stackChain = chainFor(stackTrace);
if (_onError == null) {
- return parent.handleUncaughtError(zone, error, chainFor(stackTrace));
- } else {
- _onError(error, chainFor(stackTrace));
+ return parent.handleUncaughtError(zone, error, stackChain);
+ }
+
+ // TODO(nweiz): Currently this copies a lot of logic from [runZoned]. Just
+ // allow [runBinary] to throw instead once issue 18134 is fixed.
+ try {
+ return parent.runBinary(zone, _onError, error, stackChain);
+ } catch (newError, newStackTrace) {
+ if (identical(newError, error)) {
+ return parent.handleUncaughtError(zone, error, stackChain);
+ } else {
+ return parent.handleUncaughtError(zone, newError, newStackTrace);
+ }
}
}
« no previous file with comments | « no previous file | pkg/stack_trace/test/chain_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698