Index: pkg/dev_compiler/tool/input_sdk/private/interceptors.dart |
diff --git a/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart b/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart |
index fb3942a3840e532853ae90803f2bebb9bfd80c59..907a5156b0c0edde6f1b436be91b14dbc63ce7c1 100644 |
--- a/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart |
+++ b/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart |
@@ -94,6 +94,21 @@ class UnknownJavaScriptObject extends JavaScriptObject { |
String toString() => JS('String', 'String(#)', this); |
} |
+// Note that this needs to be in interceptors.dart in order for |
+// it to be picked up as an extension type. |
+@JsPeerInterface(name: 'TypeError') |
+class NullError extends Interceptor implements NoSuchMethodError { |
+ StackTrace get stackTrace => Primitives.extractStackTrace(this); |
+ |
+ String toString() { |
+ // TODO(vsm): Distinguish between null reference errors and other |
+ // TypeErrors. We should not get non-null TypeErrors from DDC code, |
+ // but we may from native JavaScript. |
+ var message = JS('String', '#.message', this); |
+ return "NullError: $message"; |
+ } |
+} |
+ |
// Obsolete in dart dev compiler. Added only so that the same version of |
// dart:html can be used in dart2js an dev compiler. |
// Warning: calls to these methods need to be removed before custom elements |