report method

  1. @override
Future<void> report(
  1. String approvedPath,
  2. String receivedPath
)
override

Implementation

@override
Future<void> report(String approvedPath, String receivedPath) async {
  final DiffInfo diffInfo = defaultDiffInfo;

  try {
    await Future.wait([
      _checkFileExists(approvedPath),
      _checkFileExists(receivedPath),
    ]);

    await Process.run(
      diffInfo.command,
      [diffInfo.arg, approvedPath, receivedPath],
    );
  } catch (e, st) {
    if (e is PathNotFoundException) {
      ApprovalLogger.exception(e, stackTrace: st);
      rethrow;
    }
    if (e is ProcessException) {
      final ProcessResult result =
          await Process.run(ApprovalUtils.commandWhere, [diffInfo.command]);
      ApprovalLogger.exception(
        'Error during comparison via ${ide.name}. Please try check path of IDE. \n Current path: ${diffInfo.command} with arg: "${diffInfo.arg}" \n Path to IDE (${Platform.operatingSystem}): ${result.stdout} \n Please, add path to customDiffInfo.',
        stackTrace: st,
      );
    }
    rethrow;
  }
}