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

Side by Side Diff: lib/src/runner/load_exception.dart

Issue 1163593004: Make LoadException resilient to the new load error format. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 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
« 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) 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 library test.runner.load_exception; 5 library test.runner.load_exception;
6 6
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 8
9 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 import 'package:source_span/source_span.dart'; 10 import 'package:source_span/source_span.dart';
(...skipping 14 matching lines...) Expand all
25 if (color) buffer.write('\u001b[0m'); // no color 25 if (color) buffer.write('\u001b[0m'); // no color
26 26
27 var innerString = getErrorMessage(innerError); 27 var innerString = getErrorMessage(innerError);
28 if (innerError is IsolateSpawnException) { 28 if (innerError is IsolateSpawnException) {
29 // If this is a parse error, get rid of the noisy preamble. 29 // If this is a parse error, get rid of the noisy preamble.
30 innerString = innerString 30 innerString = innerString
31 .replaceFirst("'${p.toUri(p.absolute(path))}': error: ", ""); 31 .replaceFirst("'${p.toUri(p.absolute(path))}': error: ", "");
32 32
33 // If this is a file system error, get rid of both the preamble and the 33 // If this is a file system error, get rid of both the preamble and the
34 // useless stack trace. 34 // useless stack trace.
35
36 // This message was used prior to 1.11.0-dev.3.0.
35 innerString = innerString.replaceFirst( 37 innerString = innerString.replaceFirst(
36 "Unhandled exception:\n" 38 "Unhandled exception:\n"
37 "Uncaught Error: Load Error: ", 39 "Uncaught Error: Load Error: ",
38 ""); 40 "");
41
42 // This message was used after 1.11.0-dev.3.0.
43 innerString = innerString.replaceFirst(
44 "Unhandled exception:\n"
45 "Load Error for ",
46 "");
47
39 innerString = innerString.replaceFirst("FileSystemException: ", ""); 48 innerString = innerString.replaceFirst("FileSystemException: ", "");
40 innerString = innerString.split("Stack Trace:\n").first.trim(); 49 innerString = innerString.split("Stack Trace:\n").first.trim();
41 } if (innerError is SourceSpanException) { 50 } if (innerError is SourceSpanException) {
42 innerString = innerError.toString(color: color) 51 innerString = innerError.toString(color: color)
43 .replaceFirst(" of $path", ""); 52 .replaceFirst(" of $path", "");
44 } 53 }
45 54
46 buffer.write(innerString.contains("\n") ? "\n" : " "); 55 buffer.write(innerString.contains("\n") ? "\n" : " ");
47 buffer.write(innerString); 56 buffer.write(innerString);
48 return buffer.toString(); 57 return buffer.toString();
49 } 58 }
50 } 59 }
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