| Index: pkg/front_end/lib/memory_file_system.dart
|
| diff --git a/pkg/front_end/lib/memory_file_system.dart b/pkg/front_end/lib/memory_file_system.dart
|
| index 6c57167a87d45e1620fadab02a82fe585658256d..f53f24a8632bfe875f00a81f20e9cbb8d72520fd 100644
|
| --- a/pkg/front_end/lib/memory_file_system.dart
|
| +++ b/pkg/front_end/lib/memory_file_system.dart
|
| @@ -67,32 +67,36 @@ class MemoryFileSystemEntity implements FileSystemEntity {
|
| identical(other._fileSystem, _fileSystem);
|
|
|
| @override
|
| - Future<List<int>> readAsBytes() async {
|
| - List<int> contents = _fileSystem._files[uri];
|
| - if (contents != null) {
|
| - return contents.toList();
|
| - }
|
| - throw new Exception('File does not exist');
|
| - }
|
| -
|
| - @override
|
| - Future<String> readAsString() async {
|
| - List<int> contents = await readAsBytes();
|
| - return UTF8.decode(contents);
|
| - }
|
| -
|
| - @override
|
| Future<bool> exists() async => _fileSystem._files[uri] != null;
|
|
|
| @override
|
| Future<DateTime> lastModified() async {
|
| var lastModified = _fileSystem._lastModified[uri];
|
| if (lastModified == null) {
|
| - throw new Exception('File does not exist');
|
| + throw new FileSystemException(uri, 'File $uri does not exist.');
|
| }
|
| return lastModified;
|
| }
|
|
|
| + @override
|
| + Future<List<int>> readAsBytes() async {
|
| + List<int> contents = _fileSystem._files[uri];
|
| + if (contents == null) {
|
| + throw new FileSystemException(uri, 'File $uri does not exist.');
|
| + }
|
| + return contents.toList();
|
| + }
|
| +
|
| + @override
|
| + Future<String> readAsString() async {
|
| + List<int> bytes = await readAsBytes();
|
| + try {
|
| + return UTF8.decode(bytes);
|
| + } on FormatException catch (e) {
|
| + throw new FileSystemException(uri, e.message);
|
| + }
|
| + }
|
| +
|
| /// Writes the given raw bytes to this file system entity.
|
| ///
|
| /// If no file exists, one is created. If a file exists already, it is
|
|
|