Index: sdk/lib/_internal/pub/lib/src/dart.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/dart.dart b/sdk/lib/_internal/pub/lib/src/dart.dart |
index e0701a4bffa47dbdbc5d40a13175c3c667ea725a..d183f37e40cbbb65c7ad70aaee6c19ad210af186 100644 |
--- a/sdk/lib/_internal/pub/lib/src/dart.dart |
+++ b/sdk/lib/_internal/pub/lib/src/dart.dart |
@@ -57,7 +57,10 @@ Future<String> compile(String entrypoint, {String packageRoot, |
path.toUri(entrypoint), |
path.toUri(appendSlash(_libPath)), |
path.toUri(appendSlash(packageRoot)), |
- inputProvider, diagnosticHandler, options); |
+ inputProvider, diagnosticHandler, options).then((js) { |
+ if (js == null) throw new CompilerException(entrypoint); |
+ return js; |
+ }); |
}); |
} |
@@ -175,3 +178,9 @@ class CrossIsolateException implements Exception { |
String toString() => "$message\n$stackTrace"; |
} |
+ |
+/// An exception thrown when dart2js generates compiler errors. |
+class CompilerException extends ApplicationException { |
+ CompilerException(String entrypoint) |
+ : super('Failed to compile "$entrypoint".'); |
+} |