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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.translate_uri; 5 library fasta.translate_uri;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 import 'dart:io' show FileSystemException;
8 9
9 import 'package:front_end/file_system.dart'; 10 import 'package:front_end/file_system.dart';
10 import 'package:package_config/packages_file.dart' as packages_file show parse; 11 import 'package:package_config/packages_file.dart' as packages_file show parse;
11 12
12 import 'errors.dart' show inputError; 13 import 'errors.dart' show inputError;
13 14
14 class TranslateUri { 15 class TranslateUri {
15 final Map<String, Uri> packages; 16 final Map<String, Uri> packages;
16 final Map<String, Uri> dartLibraries; 17 final Map<String, Uri> dartLibraries;
17 18
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 "svg": sdk.resolve("lib/svg/dartium/svg_dartium.dart"), 91 "svg": sdk.resolve("lib/svg/dartium/svg_dartium.dart"),
91 "typed_data": sdk.resolve("lib/typed_data/typed_data.dart"), 92 "typed_data": sdk.resolve("lib/typed_data/typed_data.dart"),
92 "vmservice_io": sdk.resolve("lib/vmservice_io/vmservice_io.dart"), 93 "vmservice_io": sdk.resolve("lib/vmservice_io/vmservice_io.dart"),
93 "web_audio": 94 "web_audio":
94 sdk.resolve("lib/web_audio/dartium/web_audio_dartium.dart"), 95 sdk.resolve("lib/web_audio/dartium/web_audio_dartium.dart"),
95 "web_gl": sdk.resolve("lib/web_gl/dartium/web_gl_dartium.dart"), 96 "web_gl": sdk.resolve("lib/web_gl/dartium/web_gl_dartium.dart"),
96 "web_sql": sdk.resolve("lib/web_sql/dartium/web_sql_dartium.dart"), 97 "web_sql": sdk.resolve("lib/web_sql/dartium/web_sql_dartium.dart"),
97 }; 98 };
98 } 99 }
99 uri ??= Uri.base.resolve(".packages"); 100 uri ??= Uri.base.resolve(".packages");
100 List<int> bytes = await fileSystem.entityForUri(uri).readAsBytes(); 101
102 List<int> bytes;
103 try {
104 FileSystemException;
105 bytes = await fileSystem.entityForUri(uri).readAsBytes();
106 } on FileSystemException catch (e) {
107 String message = e.message;
108 String osMessage = e.osError?.message;
109 if (osMessage != null && osMessage.isNotEmpty) {
110 message = osMessage;
111 }
112 inputError(uri, -1, message);
113 }
114
101 Map<String, Uri> packages = const <String, Uri>{}; 115 Map<String, Uri> packages = const <String, Uri>{};
102 try { 116 try {
103 packages = packages_file.parse(bytes, uri); 117 packages = packages_file.parse(bytes, uri);
104 } on FormatException catch (e) { 118 } on FormatException catch (e) {
105 return inputError(uri, e.offset, e.message); 119 return inputError(uri, e.offset, e.message);
106 } 120 }
107 return new TranslateUri(packages, dartLibraries); 121 return new TranslateUri(packages, dartLibraries);
108 } 122 }
109 } 123 }
OLDNEW
« 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