From 4c4e71cc2f6cbc22f83db8ad9acf1109466530df Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 13 Mar 2019 16:44:57 -0500 Subject: [PATCH] (GH-1581) Log error that caused .registry.bad file Previously, when a .registry file was moved to .registry.bad, there wasn't an indication of what all might have caused it to be set that way. Provide some logging based on exactly what causes it, and provide the entire error output instead of just the message for now. --- .../services/ChocolateyPackageInformationService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs index 688cb50dcd..999803de91 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs @@ -98,8 +98,14 @@ focus exclusively in the string values not surrounded by CData. Once packageInformation.RegistrySnapshot = _registryService.read_from_file(_fileSystem.combine_paths(pkgStorePath, REGISTRY_SNAPSHOT_FILE)); } } - catch (Exception) + catch (Exception e) { + if (_config.RegularOutput) this.Log().Warn(@"A .registry file at '{0}' + has errored attempting to read it. This file will be renamed to + '{1}' The error: + {2} + ".format_with(_fileSystem.combine_paths(pkgStorePath, REGISTRY_SNAPSHOT_FILE), _fileSystem.combine_paths(pkgStorePath, REGISTRY_SNAPSHOT_BAD_FILE), e.ToString())); + FaultTolerance.try_catch_with_logging_exception( () => {