Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: sdk/lib/async/zone.dart

Issue 598993002: Add missing null-tests to async error functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/async/zone.dart
diff --git a/sdk/lib/async/zone.dart b/sdk/lib/async/zone.dart
index 1f2993d2f5413689f361b52c13832173370be43b..a591ae161cbae2f74c0359df29328b985a15c150 100644
--- a/sdk/lib/async/zone.dart
+++ b/sdk/lib/async/zone.dart
@@ -36,12 +36,15 @@ typedef Zone ForkHandler(Zone self, ZoneDelegate parent, Zone zone,
ZoneSpecification specification,
Map zoneValues);
-/// Pair of error and stack trace. Returned by [Zone.errorCallback].
+/** Pair of error and stack trace. Returned by [Zone.errorCallback]. */
class AsyncError implements Error {
final error;
final StackTrace stackTrace;
- AsyncError(this.error, this.stackTrace);
+ AsyncError(this.error, this.stackTrace) {
+ if (error == null) throw new ArgumentError("Error must not be null");
floitsch 2014/09/24 12:59:14 Or make it a NullThrownError?
+ }
+
String toString() => error.toString();
}
@@ -254,10 +257,10 @@ abstract class Zone {
// Private constructor so that it is not possible instantiate a Zone class.
Zone._();
- /// The root zone that is implicitly created.
+ /** The root zone that is implicitly created. */
floitsch 2014/09/24 12:59:14 why this change?
Lasse Reichstein Nielsen 2014/09/24 13:49:57 Just because the comment style was inconsistent wi
static const Zone ROOT = _ROOT_ZONE;
- /// The currently running zone.
+ /** The currently running zone. */
static Zone _current = _ROOT_ZONE;
static Zone get current => _current;
@@ -416,6 +419,8 @@ abstract class Zone {
* The original error is used unchanged in that case.
* Otherwise return an instance of [AsyncError] holding
* the new pair of error and stack trace.
+ *
+ * The returned [AsyncError.error] must not be `null`.
*/
AsyncError errorCallback(Object error, StackTrace stackTrace);

Powered by Google App Engine
This is Rietveld 408576698