handle method

void handle(
  1. dynamic e
)

Implementation

void handle(dynamic e) {
  if (e is CliException) {
    LogService.error(e.message!);
    if (e.codeSample!.isNotEmpty) {
      LogService.info('Example:'.tr, false, false);
      // ignore: avoid_print
      print(LogService.codeBold(e.codeSample!));
    }
  } else if (e is FileSystemException) {
    if (e.osError!.errorCode == 2) {
      LogService.error('File not found in %s'.trArgs([e.path]));
      return;
    } else if (e.osError!.errorCode == 13) {
      LogService.error('Access denied to %s'.trArgs([e.path]));
      return;
    }
    _logException(e.message);
  } else {
    _logException(e.toString());
  }
  if (!Platform.isWindows) exit(0);
}