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

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

Issue 2407603002: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/null_patch.dart ('k') | sdk/lib/core/null.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 c11ea2e1a97da25e0c73490a216d7ec025492dc6..6dce2af78dcaf0286d4585d327b33144656a807a 100644
--- a/sdk/lib/core/errors.dart
+++ b/sdk/lib/core/errors.dart
@@ -120,6 +120,21 @@ class NullThrownError extends Error {
}
/**
+ * Error thrown when attempting to dereference [:null:].
+ */
+class NullDereferenceError extends Error implements NoSuchMethodError {
+ /** Message describing the problem. */
+ final message;
+
+ /**
+ * The [message] optionally describes the circumstances under which [:null:] was dereferenced.
Cutch 2016/10/07 23:24:11 80 columns...
+ */
+ NullDereferenceError([this.message]);
+
+ String toString() => "Cannot dereference null.${ message != null ? ' $message' : ''}";
+}
+
+/**
* Error thrown when a function is passed an unacceptable argument.
*/
class ArgumentError extends Error {
« no previous file with comments | « runtime/lib/null_patch.dart ('k') | sdk/lib/core/null.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698