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

Side by Side Diff: sdk/lib/core/errors.dart

Issue 1460903003: corelib: Do not print value in ArgumentError.notNull (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests/corelib/errors_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * Error objects thrown in the case of a program failure. 8 * Error objects thrown in the case of a program failure.
9 * 9 *
10 * An `Error` object represents a program failure that the programmer 10 * An `Error` object represents a program failure that the programmer
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 * interface method's argument name (or just rename arguments to match). 158 * interface method's argument name (or just rename arguments to match).
159 */ 159 */
160 ArgumentError.value(value, 160 ArgumentError.value(value,
161 [String this.name, 161 [String this.name,
162 String this.message]) 162 String this.message])
163 : invalidValue = value, 163 : invalidValue = value,
164 _hasValue = true; 164 _hasValue = true;
165 165
166 /** 166 /**
167 * Create an argument error for a `null` argument that must not be `null`. 167 * Create an argument error for a `null` argument that must not be `null`.
168 *
169 * Shorthand for calling [ArgumentError.value] with a `null` value and a
170 * message of `"Must not be null"`.
171 */ 168 */
172 ArgumentError.notNull([String name]) 169 ArgumentError.notNull([this.name])
173 : this.value(null, name, "Must not be null"); 170 : _hasValue = false,
171 message = "Must not be null",
172 invalidValue = null;
174 173
175 // Helper functions for toString overridden in subclasses. 174 // Helper functions for toString overridden in subclasses.
176 String get _errorName => "Invalid argument${!_hasValue ? "(s)" : ""}"; 175 String get _errorName => "Invalid argument${!_hasValue ? "(s)" : ""}";
177 String get _errorExplanation => ""; 176 String get _errorExplanation => "";
178 177
179 String toString() { 178 String toString() {
180 String nameString = ""; 179 String nameString = "";
181 if (name != null) { 180 if (name != null) {
182 nameString = " ($name)"; 181 nameString = " ($name)";
183 } 182 }
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 * the first time it is read. If evaluating the initializer expression causes 564 * the first time it is read. If evaluating the initializer expression causes
566 * another read of the variable, this error is thrown. 565 * another read of the variable, this error is thrown.
567 */ 566 */
568 class CyclicInitializationError extends Error { 567 class CyclicInitializationError extends Error {
569 final String variableName; 568 final String variableName;
570 CyclicInitializationError([this.variableName]); 569 CyclicInitializationError([this.variableName]);
571 String toString() => variableName == null 570 String toString() => variableName == null
572 ? "Reading static variable during its initialization" 571 ? "Reading static variable during its initialization"
573 : "Reading static variable '$variableName' during its initialization"; 572 : "Reading static variable '$variableName' during its initialization";
574 } 573 }
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/errors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698