Skip to content

Commit

Permalink
Merge pull request dart-lang/stack_trace#38 from dart-lang/cast-failure
Browse files Browse the repository at this point in the history
Fix runtime cast failure in chainForTrace().
  • Loading branch information
munificent authored Feb 14, 2018
2 parents aef5384 + bdbd3be commit 1cf86c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions pkgs/stack_trace/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## 1.9.2

* 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.

Expand Down
2 changes: 1 addition & 1 deletion pkgs/stack_trace/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.2
author: "Dart Team <misc@dartlang.org>"
homepage: https://github.com/dart-lang/stack_trace
description: A package for manipulating stack traces and printing them readably.
Expand Down
6 changes: 2 additions & 4 deletions pkgs/stack_trace/test/chain/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Stream controllerErrorStream([StackTrace trace]) {
/// Runs [callback] within [asyncFn], then converts any errors raised into a
/// [Chain] with [Chain.forTrace].
Future<Chain> chainForTrace(asyncFn(callback()), callback()) {
var completer = new Completer();
var completer = new Completer<Chain>();
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
Expand All @@ -75,10 +75,8 @@ Future<Chain> 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<Chain>;
.catchError((_, stackTrace) => new Chain.forTrace(stackTrace));
}

/// Runs [callback] in a [Chain.capture] zone and returns a Future that
Expand Down

0 comments on commit 1cf86c4

Please sign in to comment.