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

Unified Diff: dart/lib/compiler/implementation/dart2js.dart

Issue 10382195: Don't report an internal error if attempting to compile a file that doesn't exist. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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
Index: dart/lib/compiler/implementation/dart2js.dart
diff --git a/dart/lib/compiler/implementation/dart2js.dart b/dart/lib/compiler/implementation/dart2js.dart
index bd2fd8a0a6d07da2dd9276a3105006e0a7a4a6e6..8b6a7865a6f35aae21bf8fb9301e23d4084cf1e0 100644
--- a/dart/lib/compiler/implementation/dart2js.dart
+++ b/dart/lib/compiler/implementation/dart2js.dart
@@ -109,7 +109,12 @@ void compile(List<String> argv) {
if (uri.scheme != 'file') {
throw new IllegalArgumentException(uri);
}
- String source = readAll(uriPathToNative(uri.path));
+ String source;
+ try {
+ source = readAll(uriPathToNative(uri.path));
+ } catch (FileIOException ex) {
+ throw 'Error: Cannot read "${relativize(cwd, uri)}" (${ex.osError}).';
+ }
dartBytesRead += source.length;
sourceFiles[uri.toString()] =
new SourceFile(relativize(cwd, uri), source);
@@ -122,7 +127,10 @@ void compile(List<String> argv) {
if (verbose) print('${colors.green("info:")} $message');
}
+ bool isAborting = false;
+
void handler(Uri uri, int begin, int end, String message, bool fatal) {
+ if (isAborting) return;
if (uri === null && !fatal) {
info(message);
return;
@@ -134,7 +142,10 @@ void compile(List<String> argv) {
SourceFile file = sourceFiles[uri.toString()];
print(file.getLocationMessage(message, begin, end, true));
}
- if (fatal && throwOnError) throw new AbortLeg(message);
+ if (fatal && throwOnError) {
+ isAborting = true;
+ throw new AbortLeg(message);
+ }
}
Uri uri = cwd.resolve(arguments[0]);
« no previous file with comments | « dart/lib/compiler/implementation/apiimpl.dart ('k') | dart/lib/compiler/implementation/scanner/scanner_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698