| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 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 innerString = innerString.replaceFirst( | 35 innerString = innerString.replaceFirst( |
| 36 "Unhandled exception:\n" | 36 "Unhandled exception:\n" |
| 37 "Uncaught Error: Load Error: FileSystemException: ", | 37 "Uncaught Error: Load Error: ", |
| 38 ""); | 38 ""); |
| 39 innerString = innerString.replaceFirst("FileSystemException: ", ""); |
| 39 innerString = innerString.split("Stack Trace:\n").first.trim(); | 40 innerString = innerString.split("Stack Trace:\n").first.trim(); |
| 40 } if (innerError is SourceSpanException) { | 41 } if (innerError is SourceSpanException) { |
| 41 innerString = innerError.toString(color: color) | 42 innerString = innerError.toString(color: color) |
| 42 .replaceFirst(" of $path", ""); | 43 .replaceFirst(" of $path", ""); |
| 43 } | 44 } |
| 44 | 45 |
| 45 buffer.write(innerString.contains("\n") ? "\n" : " "); | 46 buffer.write(innerString.contains("\n") ? "\n" : " "); |
| 46 buffer.write(innerString); | 47 buffer.write(innerString); |
| 47 return buffer.toString(); | 48 return buffer.toString(); |
| 48 } | 49 } |
| 49 } | 50 } |
| OLD | NEW |