private async Task ExecuteValidation()

in WiMigrator/CommandLine.cs [71:109]


        private async Task ExecuteValidation(CommandOption validate)
        {
            bool showedHelp = false;
            ConfigJson configJson = null;
            try
            {
                string configFileName = validate.Value();
                ConfigReaderJson configReaderJson = new ConfigReaderJson(configFileName);
                configJson = configReaderJson.Deserialize();

                var validatorContext = new ValidationContext(configJson);
                using (var heartbeat = new ValidationHeartbeatLogger(validatorContext.WorkItemsMigrationState, validatorContext, validatorContext.Config.HeartbeatFrequencyInSeconds))
                {
                    await new Validator(validatorContext).Validate();
                    heartbeat.Beat();
                }
            }
            catch (CommandParsingException e)
            {
                Logger.LogError(LogDestination.All, e, "Invalid command line option(s):");
                commandLineApplication.ShowHelp();
                showedHelp = true;
            }
            catch (Exception e) when (e is ValidationException)
            {
                Logger.LogError(LogDestination.All, e, "Validation error:");
            }
            catch (Exception e)
            {
                Logger.LogError(LogDestination.All, e, "Unexpected error:");
            }
            finally
            {
                if (!showedHelp && configJson != null)
                {
                    SendSummaryEmail(configJson);
                }
            }
        }