Skip to content

Commit

Permalink
Error handling in completion_metrics.dart - don't attempt to create a…
Browse files Browse the repository at this point in the history
…n AnalysisContextCollection until we have determined that the included path exists on the machine.

Change-Id: I15e2884bfd9e243f0b01081e1c43a929ceaeae1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132222
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
  • Loading branch information
jwren authored and commit-bot@chromium.org committed Jan 17, 2020
1 parent c8f8c11 commit 9c6e548
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'dart:async';
import 'dart:math';
import 'dart:io' as io;

import 'package:analysis_server/src/protocol_server.dart';
import 'package:analysis_server/src/services/completion/completion_core.dart';
Expand Down Expand Up @@ -32,7 +33,13 @@ Future _computeCompletionMetrics(
int notIncludedCount = 0;

for (var root in analysisRoots) {
print('Analyzing root: $root');
print('Analyzing root: \"$root\"');

if (!io.Directory(root).existsSync()) {
print('\tError: No such directory exists on this machine.\n');
continue;
}

final collection = AnalysisContextCollection(
includedPaths: [root],
resourceProvider: resourceProvider,
Expand Down

0 comments on commit 9c6e548

Please sign in to comment.