Deprecate the ChainHandler typedef.
R=rnystrom@google.com
Review URL: https://codereview.chromium.org//1576853003 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dace263..c99f532 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 1.5.2
+
+* Deprecate the `ChainHandler` typedef. This didn't provide any value over
+ directly annotating the function argument, and it made the documentation less
+ clear.
+
## 1.5.1
* Fix a crash in `Chain.foldFrames()` and `Chain.terse` when one of the chain's
diff --git a/lib/src/chain.dart b/lib/src/chain.dart
index 2e63ef0..4baec21 100644
--- a/lib/src/chain.dart
+++ b/lib/src/chain.dart
@@ -14,6 +14,7 @@
import 'utils.dart';
/// A function that handles errors in the zone wrapped by [Chain.capture].
+@Deprecated("Will be removed in stack_trace 2.0.0.")
typedef void ChainHandler(error, Chain chain);
/// A chain of stack traces.
@@ -63,7 +64,7 @@
/// considered unhandled.
///
/// If [callback] returns a value, it will be returned by [capture] as well.
- static capture(callback(), {ChainHandler onError}) {
+ static capture(callback(), {void onError(error, Chain chain)}) {
var spec = new StackZoneSpecification(onError);
return runZoned(() {
try {
diff --git a/lib/src/stack_zone_specification.dart b/lib/src/stack_zone_specification.dart
index 25d9642..6de43fa 100644
--- a/lib/src/stack_zone_specification.dart
+++ b/lib/src/stack_zone_specification.dart
@@ -9,6 +9,9 @@
import 'trace.dart';
import 'chain.dart';
+/// A function that handles errors in the zone wrapped by [Chain.capture].
+typedef void _ChainHandler(error, Chain chain);
+
/// A class encapsulating the zone specification for a [Chain.capture] zone.
///
/// Until they're materialized and exposed to the user, stack chains are tracked
@@ -43,7 +46,7 @@
///
/// If this is null, that indicates that any unhandled errors should be passed
/// to the parent zone.
- final ChainHandler _onError;
+ final _ChainHandler _onError;
/// The most recent node of the current stack chain.
_Node _currentNode;