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

Unified Diff: lib/src/compiler/compiler.dart

Issue 2161693002: Catch file-not-found exception (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: Move handling to compiler.dart Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/compiler/compiler.dart
diff --git a/lib/src/compiler/compiler.dart b/lib/src/compiler/compiler.dart
index 6355dcfb17485850c1f094aaa6b85c127a0808e4..7be197079a8b450a7a9f402a6192c7ea86c35aa4 100644
--- a/lib/src/compiler/compiler.dart
+++ b/lib/src/compiler/compiler.dart
@@ -4,6 +4,7 @@
import 'dart:collection' show HashSet;
import 'package:args/args.dart' show ArgParser, ArgResults;
+import 'package:args/src/usage_exception.dart' show UsageException;
import 'package:analyzer/analyzer.dart'
show
AnalysisError,
@@ -82,6 +83,11 @@ class ModuleCompiler {
' The file name is in the wrong format or was not found.');
}
+ if (!source.exists()) {
+ throw new UsageException('Given file "$sourcePath" does not exist.',
+ 'You need to pass at least one existing .dart file as an argument.');
Jennifer Messerly 2016/07/18 19:22:01 long line
stanm 2016/07/18 21:37:29 Thanks, I noticed that, but the formatter seems to
+ }
+
// Ignore parts. They need to be handled in the context of their library.
if (context.computeKindOf(source) == SourceKind.PART) {
explicitParts.add(source);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698