From fd78c75cfac32a3e6844e605b806497d4867bd0f Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Tue, 20 Dec 2016 13:30:28 +0100 Subject: [PATCH 1/2] Update changelog.md to mention new assert with message feature Fixes https://github.com/dart-lang/sdk/issues/28134 --- CHANGELOG.md | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3c1bc850565..e3085fc6a284 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,35 @@ ## 1.22.0 +### Language + + * The `assert()` statement has been expanded to support an optional second + `message` argument (SDK issue [27342](https://github.com/dart-lang/sdk/issues/27342)). + + The message is display if the assert fails. It can be any object, and it + is accessible as `AssertionError.message`. It can be used to provide more + user friendly exception outputs. As an example, the following assert: + + ``` + assert(configFile != null, "Tool config missing. Please see https://goo.gl/k8iAi for details."); + ``` + + would produce the following exception output: + + ``` + Unhandled exception: + 'file:///Users/mit/tmp/tool/bin/main.dart': Failed assertion: line 9 pos 10: + 'configFile != null': Tool config missing. Please see https://goo.gl/k8iAi for details. + #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:33) + #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:29) + #2 main (file:///Users/mit/tmp/tool/bin/main.dart:9:10) + ``` + ### Tool changes * Dart2Js * Remove support for (long-time deprecated) mixin typedefs. -* Dart Dev Compiler - - * Support messages in `assert()` statements. (SDK issue - [27342](https://github.com/dart-lang/sdk/issues/27342)) - * Pub * Avoid using a barback asset server for executables unless they actually use From 08806f621aa4f4c40af48206c4281d1a3b8d3959 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Tue, 20 Dec 2016 14:20:10 +0100 Subject: [PATCH 2/2] Fix typo per review feedback --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3085fc6a284..a3945fdc8c3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ * The `assert()` statement has been expanded to support an optional second `message` argument (SDK issue [27342](https://github.com/dart-lang/sdk/issues/27342)). - The message is display if the assert fails. It can be any object, and it + The message is displayed if the assert fails. It can be any object, and it is accessible as `AssertionError.message`. It can be used to provide more user friendly exception outputs. As an example, the following assert: