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

Unified Diff: sdk/lib/core/errors.dart

Issue 953743005: Fix bug in RangeError.value. Add tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | tests/corelib/errors_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/errors.dart
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart
index a67340660307349df0f7f3866c9965b091d7601f..3d36b3919fd1fb25665eed725d6275acffbc7650 100644
--- a/sdk/lib/core/errors.dart
+++ b/sdk/lib/core/errors.dart
@@ -171,7 +171,7 @@ class ArgumentError extends Error {
: this.value(null, name, "Must not be null");
// Helper functions for toString overridden in subclasses.
- String get _errorName => "Invalid argument${name == null ? "(s)" : ""}";
+ String get _errorName => "Invalid argument${!_hasValue ? "(s)" : ""}";
String get _errorExplanation => "";
String toString() {
@@ -179,9 +179,9 @@ class ArgumentError extends Error {
if (name != null) {
nameString = " ($name)";
}
- var message = this.message == null ? "" : ": ${this.message}";
+ var message = (this.message == null) ? "" : ": ${this.message}";
String prefix = "$_errorName$nameString$message";
- if (invalidValue == null) return prefix;
+ if (!_hasValue) return prefix;
// If we know the invalid value, we can try to describe the problem.
String explanation = _errorExplanation;
String errorValue = Error.safeToString(invalidValue);
« 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