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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/source_file_provider.dart

Issue 16123036: Clean up dart:io exceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/stdio_patch.dart ('k') | sdk/lib/_internal/compiler/samples/leap/leap_server.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 source_file_provider; 5 library source_file_provider;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:utf'; 9 import 'dart:utf';
10 10
(...skipping 19 matching lines...) Expand all
30 Map<String, SourceFile> sourceFiles = <String, SourceFile>{}; 30 Map<String, SourceFile> sourceFiles = <String, SourceFile>{};
31 int dartCharactersRead = 0; 31 int dartCharactersRead = 0;
32 32
33 Future<String> readStringFromUri(Uri resourceUri) { 33 Future<String> readStringFromUri(Uri resourceUri) {
34 if (resourceUri.scheme != 'file') { 34 if (resourceUri.scheme != 'file') {
35 throw new ArgumentError("Unknown scheme in uri '$resourceUri'"); 35 throw new ArgumentError("Unknown scheme in uri '$resourceUri'");
36 } 36 }
37 String source; 37 String source;
38 try { 38 try {
39 source = readAll(uriPathToNative(resourceUri.path)); 39 source = readAll(uriPathToNative(resourceUri.path));
40 } on FileIOException catch (ex) { 40 } on FileException catch (ex) {
41 throw 'Error: Cannot read "${relativize(cwd, resourceUri, isWindows)}" ' 41 throw 'Error: Cannot read "${relativize(cwd, resourceUri, isWindows)}" '
42 '(${ex.osError}).'; 42 '(${ex.osError}).';
43 } 43 }
44 dartCharactersRead += source.length; 44 dartCharactersRead += source.length;
45 sourceFiles[resourceUri.toString()] = new SourceFile( 45 sourceFiles[resourceUri.toString()] = new SourceFile(
46 relativize(cwd, resourceUri, isWindows), source); 46 relativize(cwd, resourceUri, isWindows), source);
47 return new Future.value(source); 47 return new Future.value(source);
48 } 48 }
49 49
50 Future<String> call(Uri resourceUri) => readStringFromUri(resourceUri); 50 Future<String> call(Uri resourceUri) => readStringFromUri(resourceUri);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (fatal && throwOnError) { 117 if (fatal && throwOnError) {
118 isAborting = true; 118 isAborting = true;
119 throw new AbortLeg(message); 119 throw new AbortLeg(message);
120 } 120 }
121 } 121 }
122 122
123 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) { 123 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) {
124 return diagnosticHandler(uri, begin, end, message, kind); 124 return diagnosticHandler(uri, begin, end, message, kind);
125 } 125 }
126 } 126 }
OLDNEW
« no previous file with comments | « runtime/bin/stdio_patch.dart ('k') | sdk/lib/_internal/compiler/samples/leap/leap_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698