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

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

Issue 2403203002: Revert "Give useful message for null derefs" (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/core_patch.dart ('k') | sdk/lib/core/null.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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 114
115 /** 115 /**
116 * Error thrown when attempting to throw [:null:]. 116 * Error thrown when attempting to throw [:null:].
117 */ 117 */
118 class NullThrownError extends Error { 118 class NullThrownError extends Error {
119 String toString() => "Throw of null."; 119 String toString() => "Throw of null.";
120 } 120 }
121 121
122 /** 122 /**
123 * Error thrown when attempting to dereference [:null:].
124 */
125 class NullDereferenceError extends Error implements NoSuchMethodError {
126 /** Message describing the problem. */
127 final message;
128
129 /**
130 * The [message] optionally describes the circumstances
131 * under which [:null:] was dereferenced.
132 */
133 NullDereferenceError([this.message]);
134
135 String toString() {
136 return "Cannot dereference null.${ message != null ? ' $message' : ''}";
137 }
138 }
139
140 /**
141 * Error thrown when a function is passed an unacceptable argument. 123 * Error thrown when a function is passed an unacceptable argument.
142 */ 124 */
143 class ArgumentError extends Error { 125 class ArgumentError extends Error {
144 /** Whether value was provided. */ 126 /** Whether value was provided. */
145 final bool _hasValue; 127 final bool _hasValue;
146 /** The invalid value. */ 128 /** The invalid value. */
147 final invalidValue; 129 final invalidValue;
148 /** Name of the invalid argument, if available. */ 130 /** Name of the invalid argument, if available. */
149 final String name; 131 final String name;
150 /** Message describing the problem. */ 132 /** Message describing the problem. */
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 * 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
583 * another read of the variable, this error is thrown. 565 * another read of the variable, this error is thrown.
584 */ 566 */
585 class CyclicInitializationError extends Error { 567 class CyclicInitializationError extends Error {
586 final String variableName; 568 final String variableName;
587 CyclicInitializationError([this.variableName]); 569 CyclicInitializationError([this.variableName]);
588 String toString() => variableName == null 570 String toString() => variableName == null
589 ? "Reading static variable during its initialization" 571 ? "Reading static variable during its initialization"
590 : "Reading static variable '$variableName' during its initialization"; 572 : "Reading static variable '$variableName' during its initialization";
591 } 573 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/core_patch.dart ('k') | sdk/lib/core/null.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698