From 4ebce1098bfd9915fec2c0f94b3a66b165deea47 Mon Sep 17 00:00:00 2001 From: Bob Nystrom Date: Tue, 13 Feb 2018 16:51:53 -0800 Subject: [PATCH] Fix runtime cast failure in chainForTrace(). See: https://github.com/dart-lang/sdk/issues/27223 --- pkgs/stack_trace/CHANGELOG.md | 5 +++++ pkgs/stack_trace/pubspec.yaml | 2 +- pkgs/stack_trace/test/chain/utils.dart | 6 ++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pkgs/stack_trace/CHANGELOG.md b/pkgs/stack_trace/CHANGELOG.md index 2627e7114..3c6e56c28 100644 --- a/pkgs/stack_trace/CHANGELOG.md +++ b/pkgs/stack_trace/CHANGELOG.md @@ -1,4 +1,9 @@ +## 1.9.1+1 + +* Fix Dart 2.0 runtime cast failure in test. + ## 1.9.1 + * Preserve the original chain for a trace to handle cases where an error is rethrown. diff --git a/pkgs/stack_trace/pubspec.yaml b/pkgs/stack_trace/pubspec.yaml index f7c562d4a..93ffeb3dc 100644 --- a/pkgs/stack_trace/pubspec.yaml +++ b/pkgs/stack_trace/pubspec.yaml @@ -7,7 +7,7 @@ name: stack_trace # # When the major version is upgraded, you *must* update that version constraint # in pub to stay in sync with this. -version: 1.9.1 +version: 1.9.1+1 author: "Dart Team " homepage: https://github.com/dart-lang/stack_trace description: A package for manipulating stack traces and printing them readably. diff --git a/pkgs/stack_trace/test/chain/utils.dart b/pkgs/stack_trace/test/chain/utils.dart index bf821588d..0c5c98372 100644 --- a/pkgs/stack_trace/test/chain/utils.dart +++ b/pkgs/stack_trace/test/chain/utils.dart @@ -64,7 +64,7 @@ Stream controllerErrorStream([StackTrace trace]) { /// Runs [callback] within [asyncFn], then converts any errors raised into a /// [Chain] with [Chain.forTrace]. Future chainForTrace(asyncFn(callback()), callback()) { - var completer = new Completer(); + var completer = new Completer(); asyncFn(() { // We use `new Future.value().then(...)` here as opposed to [new Future] or // [new Future.sync] because those methods don't pass the exception through @@ -75,10 +75,8 @@ Future chainForTrace(asyncFn(callback()), callback()) { .catchError(completer.completeError); }); - // TODO(rnystrom): Remove this cast if catchError() gets a better type. return completer.future - .catchError((_, stackTrace) => new Chain.forTrace(stackTrace)) - as Future; + .catchError((_, stackTrace) => new Chain.forTrace(stackTrace)); } /// Runs [callback] in a [Chain.capture] zone and returns a Future that