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

Side by Side Diff: runtime/bin/vmservice/loader.dart

Issue 1641383003: Improve the error message when an import fails. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code review Created 4 years, 10 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 | « runtime/bin/builtin.dart ('k') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 part of vmservice_io; 5 part of vmservice_io;
6 6
7 _log(msg) { 7 _log(msg) {
8 print("% $msg"); 8 print("% $msg");
9 } 9 }
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 Timer.run(() {}); 50 Timer.run(() {});
51 } 51 }
52 52
53 void _loadFile(SendPort sp, int id, Uri uri) { 53 void _loadFile(SendPort sp, int id, Uri uri) {
54 var path = uri.toFilePath(); 54 var path = uri.toFilePath();
55 var sourceFile = new File(path); 55 var sourceFile = new File(path);
56 sourceFile.readAsBytes().then((data) { 56 sourceFile.readAsBytes().then((data) {
57 _sendResourceResponse(sp, id, data); 57 _sendResourceResponse(sp, id, data);
58 }, 58 },
59 onError: (e) { 59 onError: (e) {
60 var err = "Error loading $uri:\n $e"; 60 _sendResourceResponse(sp, id, e.toString());
61 _sendResourceResponse(sp, id, err);
62 }); 61 });
63 } 62 }
64 63
65 void _loadDataUri(SendPort sp, int id, Uri uri) { 64 void _loadDataUri(SendPort sp, int id, Uri uri) {
66 try { 65 try {
67 var mime = uri.data.mimeType; 66 var mime = uri.data.mimeType;
68 if ((mime != "application/dart") && 67 if ((mime != "application/dart") &&
69 (mime != "text/plain")) { 68 (mime != "text/plain")) {
70 throw "MIME-type must be application/dart or text/plain: $mime given."; 69 throw "MIME-type must be application/dart or text/plain: $mime given.";
71 } 70 }
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 assert(id != null); 453 assert(id != null);
455 String resource = request[3]; 454 String resource = request[3];
456 assert(resource != null); 455 assert(resource != null);
457 var uri = Uri.parse(resource); 456 var uri = Uri.parse(resource);
458 if (id >= 0) { 457 if (id >= 0) {
459 _handleResourceRequest(sp, traceLoading, id, uri); 458 _handleResourceRequest(sp, traceLoading, id, uri);
460 } else { 459 } else {
461 _handlePackagesRequest(sp, traceLoading, id, uri); 460 _handlePackagesRequest(sp, traceLoading, id, uri);
462 } 461 }
463 } 462 }
OLDNEW
« no previous file with comments | « runtime/bin/builtin.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698