Skip to content

Commit

Permalink
catch parse exceptions from args
Browse files Browse the repository at this point in the history
  • Loading branch information
devoncarew committed Sep 16, 2015
1 parent e5b3524 commit 6f3710e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 9 additions & 1 deletion pkg/dev_compiler/bin/dartdevc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ void _showUsageAndExit() {
}

main(List<String> args) async {
var options = validateOptions(args);
var options;

try {
options = validateOptions(args);
} on FormatException catch (e) {
print('${e.message}\n');
_showUsageAndExit();
}

if (options == null || options.help) _showUsageAndExit();

setupLogger(options.logLevel, print);
Expand Down
11 changes: 9 additions & 2 deletions pkg/dev_compiler/bin/devrun.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ main(List<String> args) async {
..add('--arrow-fn-bind-this')
..addAll(args);

CompilerOptions options = validateOptions(args, forceOutDir: true);
if (options == null || options.help) {
CompilerOptions options;

try {
options = validateOptions(args, forceOutDir: true);
} on FormatException catch (e) {
print('${e.message}\n');
_showUsageAndExit();
}

if (options == null || options.help) _showUsageAndExit();

if (options.inputs.length != 1) {
stderr.writeln("Please only specify one input to run");
_showUsageAndExit();
Expand Down

0 comments on commit 6f3710e

Please sign in to comment.