Make the IO interface align with the VM API

This commit is contained in:
Natalie Weizenbaum 2021-03-18 21:43:02 -07:00
parent 654744f5f4
commit 102d3cedc2
3 changed files with 11 additions and 3 deletions

View File

@ -88,7 +88,11 @@ Future<void> main(List<String> args) async {
if (exitCode != 66) exitCode = 65; if (exitCode != 66) exitCode = 65;
if (options.stopOnError) return; if (options.stopOnError) return;
} on FileSystemException catch (error, stackTrace) { } on FileSystemException catch (error, stackTrace) {
printError("Error reading ${p.relative(error.path)}: ${error.message}.", var path = error.path;
printError(
path == null
? error.message
: "Error reading ${p.relative(path)}: ${error.message}.",
options.trace ? stackTrace : null); options.trace ? stackTrace : null);
// Error 66 indicates no input. // Error 66 indicates no input.

View File

@ -82,7 +82,11 @@ class _Watcher {
exitCode = 65; exitCode = 65;
return false; return false;
} on FileSystemException catch (error, stackTrace) { } on FileSystemException catch (error, stackTrace) {
_printError("Error reading ${p.relative(error.path)}: ${error.message}.", var path = error.path;
_printError(
path == null
? error.message
: "Error reading ${p.relative(path)}: ${error.message}.",
stackTrace); stackTrace);
exitCode = 66; exitCode = 66;
return false; return false;

View File

@ -22,7 +22,7 @@ class Stderr {
/// An error thrown by [readFile]. /// An error thrown by [readFile].
class FileSystemException { class FileSystemException {
String get message => throw ''; String get message => throw '';
String get path => throw ''; String? get path => throw '';
} }
/// The standard error for the current process. /// The standard error for the current process.