Skip to content

Update changelog.md to mention new assert with message feature #28156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use #24213 as the issue number.

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:

```
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should hide internal methods in the stack trace.

#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
Expand Down