handle method
void
handle(
- dynamic e
Implementation
void handle(dynamic e) {
if (e is CliException) {
LogService.error(e.message!);
if (e.codeSample!.isNotEmpty) {
LogService.info('例:', false, false);
// ignore: avoid_print
print(LogService.codeBold(e.codeSample!));
}
} else if (e is FileSystemException) {
if (e.osError!.errorCode == 2) {
LogService.error('在 %s 中没有找到文件'.trArgs([e.path]));
return;
} else if (e.osError!.errorCode == 13) {
LogService.error('对 %s 的访问被拒绝'.trArgs([e.path]));
return;
}
_logException(e.message);
} else {
_logException(e.toString());
}
if (!Platform.isWindows) exit(0);
}