file.dart
file.dart copied to clipboard
Local and memory implementation throw different exceptions
Trying to copy a file that does not exist throws different exceptions depending on the underlying implementation.
Assuming file aaa does not exist:
import 'package:file/file.dart';
import 'package:file/local.dart';
void main() async {
await LocalFileSystem().file('aaa').copy('else');
}
Will throw PathNotFoundException, but
import 'package:file/file.dart';
import 'package:file/memory.dart';
void main() async {
await MemoryFileSystem().file('aaa').copy('else');
}
will throw FileSystemException.
Technically FileSystemException <: FileSystemException so handling just FileSystemException should be enough. But this is still a deviation and perhaps should be handled.