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

Unified Diff: pkg/front_end/lib/src/fasta/translate_uri.dart

Issue 2864913002: [TBR] Restore try/catch for FileSystemException in TranslateUri. (Closed)
Patch Set: Created 3 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
« 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: pkg/front_end/lib/src/fasta/translate_uri.dart
diff --git a/pkg/front_end/lib/src/fasta/translate_uri.dart b/pkg/front_end/lib/src/fasta/translate_uri.dart
index bbbdaeb3d94b8f7ea7665a2ef27c7a65be35b2c4..02ff2536672360878bec55e7c86b371c03fb0636 100644
--- a/pkg/front_end/lib/src/fasta/translate_uri.dart
+++ b/pkg/front_end/lib/src/fasta/translate_uri.dart
@@ -5,6 +5,7 @@
library fasta.translate_uri;
import 'dart:async' show Future;
+import 'dart:io' show FileSystemException;
import 'package:front_end/file_system.dart';
import 'package:package_config/packages_file.dart' as packages_file show parse;
@@ -97,7 +98,20 @@ class TranslateUri {
};
}
uri ??= Uri.base.resolve(".packages");
- List<int> bytes = await fileSystem.entityForUri(uri).readAsBytes();
+
+ List<int> bytes;
+ try {
+ FileSystemException;
+ bytes = await fileSystem.entityForUri(uri).readAsBytes();
+ } on FileSystemException catch (e) {
+ String message = e.message;
+ String osMessage = e.osError?.message;
+ if (osMessage != null && osMessage.isNotEmpty) {
+ message = osMessage;
+ }
+ inputError(uri, -1, message);
+ }
+
Map<String, Uri> packages = const <String, Uri>{};
try {
packages = packages_file.parse(bytes, uri);
« 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