From e64847a32af5145c0b399e680388ad460ef41ac0 Mon Sep 17 00:00:00 2001 From: Dave Tryon <45672944+DaveTryon@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:02:26 -0700 Subject: [PATCH] fix: Expose more error messages as warnings --- .../ComponentToExternalReferenceInfoConverter.cs | 2 +- .../Converters/ExternalReferenceInfoToPathConverter.cs | 2 +- .../Executors/ComponentToPackageInfoConverter.cs | 2 +- src/Microsoft.Sbom.Api/Executors/DirectoryWalker.cs | 2 +- src/Microsoft.Sbom.Api/Executors/EnumeratorChannel.cs | 2 +- src/Microsoft.Sbom.Api/Executors/FileFilterer.cs | 2 +- src/Microsoft.Sbom.Api/Executors/FileInfoWriter.cs | 2 +- .../Executors/ManifestFileFilterer.cs | 2 +- .../Executors/ManifestFolderFilterer.cs | 2 +- .../Executors/PackageInfoJsonWriter.cs | 2 +- .../SPDXSBOMReaderForExternalDocumentReference.cs | 4 ++-- src/Microsoft.Sbom.Api/Output/MetadataBuilder.cs | 10 +++++----- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.Sbom.Api/Converters/ComponentToExternalReferenceInfoConverter.cs b/src/Microsoft.Sbom.Api/Converters/ComponentToExternalReferenceInfoConverter.cs index e3d75a97..0a5626ef 100644 --- a/src/Microsoft.Sbom.Api/Converters/ComponentToExternalReferenceInfoConverter.cs +++ b/src/Microsoft.Sbom.Api/Converters/ComponentToExternalReferenceInfoConverter.cs @@ -43,7 +43,7 @@ public ComponentToExternalReferenceInfoConverter(ILogger log) } catch (Exception e) { - log.Debug($"Encountered an error while converting SBOM component {scannedComponent.Component.Id} to external reference: {e.Message}"); + log.Warning($"Encountered an error while converting SBOM component {scannedComponent.Component.Id} to external reference: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = Entities.ErrorType.PackageError, diff --git a/src/Microsoft.Sbom.Api/Converters/ExternalReferenceInfoToPathConverter.cs b/src/Microsoft.Sbom.Api/Converters/ExternalReferenceInfoToPathConverter.cs index 27604c8a..d81ed6ef 100644 --- a/src/Microsoft.Sbom.Api/Converters/ExternalReferenceInfoToPathConverter.cs +++ b/src/Microsoft.Sbom.Api/Converters/ExternalReferenceInfoToPathConverter.cs @@ -53,7 +53,7 @@ await errors.Writer.WriteAsync(new FileValidationResult } catch (Exception e) { - log.Debug($"Encountered an error while converting external reference {externalDocumentRef.ExternalDocumentName} to path: {e.Message}"); + log.Warning($"Encountered an error while converting external reference {externalDocumentRef.ExternalDocumentName} to path: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.Other, diff --git a/src/Microsoft.Sbom.Api/Executors/ComponentToPackageInfoConverter.cs b/src/Microsoft.Sbom.Api/Executors/ComponentToPackageInfoConverter.cs index 8aa02c03..e07475c8 100644 --- a/src/Microsoft.Sbom.Api/Executors/ComponentToPackageInfoConverter.cs +++ b/src/Microsoft.Sbom.Api/Executors/ComponentToPackageInfoConverter.cs @@ -66,7 +66,7 @@ async Task ConvertComponentToPackage(ExtendedScannedComponent scannedComponent, } catch (Exception e) { - log.Debug($"Encountered an error while processing package {scannedComponent.Component.Id}: {e.Message}"); + log.Warning($"Encountered an error while processing package {scannedComponent.Component.Id}: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.PackageError, diff --git a/src/Microsoft.Sbom.Api/Executors/DirectoryWalker.cs b/src/Microsoft.Sbom.Api/Executors/DirectoryWalker.cs index 90d05b91..93a2de8d 100644 --- a/src/Microsoft.Sbom.Api/Executors/DirectoryWalker.cs +++ b/src/Microsoft.Sbom.Api/Executors/DirectoryWalker.cs @@ -69,7 +69,7 @@ async Task WalkDir(string path) } catch (Exception e) { - log.Debug($"Encountered an unknown error for {path}: {e.Message}"); + log.Warning($"Encountered an unknown error for {path}: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.Other, diff --git a/src/Microsoft.Sbom.Api/Executors/EnumeratorChannel.cs b/src/Microsoft.Sbom.Api/Executors/EnumeratorChannel.cs index 7c56a162..a09e580f 100644 --- a/src/Microsoft.Sbom.Api/Executors/EnumeratorChannel.cs +++ b/src/Microsoft.Sbom.Api/Executors/EnumeratorChannel.cs @@ -44,7 +44,7 @@ async Task Enumerate() } catch (Exception e) { - log.Debug($"Encountered an unknown error while enumerating: {e.Message}"); + log.Warning($"Encountered an unknown error while enumerating: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.Other diff --git a/src/Microsoft.Sbom.Api/Executors/FileFilterer.cs b/src/Microsoft.Sbom.Api/Executors/FileFilterer.cs index 9b317079..34e0c321 100644 --- a/src/Microsoft.Sbom.Api/Executors/FileFilterer.cs +++ b/src/Microsoft.Sbom.Api/Executors/FileFilterer.cs @@ -96,7 +96,7 @@ await errors.Writer.WriteAsync(new FileValidationResult } catch (Exception e) { - log.Debug($"Encountered an error while filtering file {file.Path}: {e.Message}"); + log.Warning($"Encountered an error while filtering file {file.Path}: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.Other, diff --git a/src/Microsoft.Sbom.Api/Executors/FileInfoWriter.cs b/src/Microsoft.Sbom.Api/Executors/FileInfoWriter.cs index c2706595..bfbc2481 100644 --- a/src/Microsoft.Sbom.Api/Executors/FileInfoWriter.cs +++ b/src/Microsoft.Sbom.Api/Executors/FileInfoWriter.cs @@ -81,7 +81,7 @@ private async Task Generate(IList filesArraySupportingSBOMs, Intern } catch (Exception e) { - log.Debug($"Encountered an error while generating json for file {sbomFile.Path}: {e.Message}"); + log.Warning($"Encountered an error while generating json for file {sbomFile.Path}: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.JsonSerializationError, diff --git a/src/Microsoft.Sbom.Api/Executors/ManifestFileFilterer.cs b/src/Microsoft.Sbom.Api/Executors/ManifestFileFilterer.cs index 4d78dd4f..45b732a9 100644 --- a/src/Microsoft.Sbom.Api/Executors/ManifestFileFilterer.cs +++ b/src/Microsoft.Sbom.Api/Executors/ManifestFileFilterer.cs @@ -69,7 +69,7 @@ await errors.Writer.WriteAsync(new FileValidationResult } catch (Exception e) { - log.Debug($"Encountered an error while filtering file {manifestFile} from the manifest: {e.Message}"); + log.Warning($"Encountered an error while filtering file {manifestFile} from the manifest: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.Other, diff --git a/src/Microsoft.Sbom.Api/Executors/ManifestFolderFilterer.cs b/src/Microsoft.Sbom.Api/Executors/ManifestFolderFilterer.cs index 06b123de..4c726038 100644 --- a/src/Microsoft.Sbom.Api/Executors/ManifestFolderFilterer.cs +++ b/src/Microsoft.Sbom.Api/Executors/ManifestFolderFilterer.cs @@ -66,7 +66,7 @@ await errors.Writer.WriteAsync(new FileValidationResult } catch (Exception e) { - log.Debug($"Encountered an error while filtering file {file}: {e.Message}"); + log.Warning($"Encountered an error while filtering file {file}: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.Other, diff --git a/src/Microsoft.Sbom.Api/Executors/PackageInfoJsonWriter.cs b/src/Microsoft.Sbom.Api/Executors/PackageInfoJsonWriter.cs index ba6b4cf5..23d3fe68 100644 --- a/src/Microsoft.Sbom.Api/Executors/PackageInfoJsonWriter.cs +++ b/src/Microsoft.Sbom.Api/Executors/PackageInfoJsonWriter.cs @@ -72,7 +72,7 @@ private async Task GenerateJson( } catch (Exception e) { - log.Debug($"Encountered an error while generating json for packageInfo {packageInfo}: {e.Message}"); + log.Warning($"Encountered an error while generating json for packageInfo {packageInfo}: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.JsonSerializationError, diff --git a/src/Microsoft.Sbom.Api/Executors/SPDXSBOMReaderForExternalDocumentReference.cs b/src/Microsoft.Sbom.Api/Executors/SPDXSBOMReaderForExternalDocumentReference.cs index 003838d2..3e3a2a91 100644 --- a/src/Microsoft.Sbom.Api/Executors/SPDXSBOMReaderForExternalDocumentReference.cs +++ b/src/Microsoft.Sbom.Api/Executors/SPDXSBOMReaderForExternalDocumentReference.cs @@ -106,7 +106,7 @@ await errors.Writer.WriteAsync(new FileValidationResult } catch (HashGenerationException e) { - log.Debug($"Encountered an error while generating hash for file {file}: {e.Message}"); + log.Warning($"Encountered an error while generating hash for file {file}: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.Other, @@ -115,7 +115,7 @@ await errors.Writer.WriteAsync(new FileValidationResult } catch (Exception e) { - log.Debug($"Encountered an error while generating externalDocumentReferenceInfo from file {file}: {e.Message}"); + log.Warning($"Encountered an error while generating externalDocumentReferenceInfo from file {file}: {e.Message}"); await errors.Writer.WriteAsync(new FileValidationResult { ErrorType = ErrorType.Other, diff --git a/src/Microsoft.Sbom.Api/Output/MetadataBuilder.cs b/src/Microsoft.Sbom.Api/Output/MetadataBuilder.cs index 3b315384..b6231a60 100644 --- a/src/Microsoft.Sbom.Api/Output/MetadataBuilder.cs +++ b/src/Microsoft.Sbom.Api/Output/MetadataBuilder.cs @@ -60,7 +60,7 @@ public bool TryGetFilesArrayHeaderName(out string headerName) catch (NotSupportedException) { headerName = null; - logger.Debug("Files array not suppored on this SBOM format."); + logger.Warning("Files array not suppored on this SBOM format."); return false; } } @@ -75,7 +75,7 @@ public bool TryGetPackageArrayHeaderName(out string headerName) catch (NotSupportedException) { headerName = null; - logger.Debug("Packages array not suppored on this SBOM format."); + logger.Warning("Packages array not suppored on this SBOM format."); return false; } } @@ -90,7 +90,7 @@ public bool TryGetExternalRefArrayHeaderName(out string headerName) catch (NotSupportedException) { headerName = null; - logger.Debug("External Document Reference array not suppored on this SBOM format."); + logger.Warning("External Document Reference array not suppored on this SBOM format."); return false; } } @@ -112,7 +112,7 @@ public bool TryGetRootPackageJson(IInternalMetadataProvider internalMetadataProv catch (NotSupportedException) { generationResult = null; - logger.Debug("Root package serialization not supported on this SBOM format."); + logger.Warning("Root package serialization not supported on this SBOM format."); return false; } } @@ -127,7 +127,7 @@ public bool TryGetRelationshipsHeaderName(out string headerName) catch (NotSupportedException) { headerName = null; - logger.Debug("Relationships array are not supported on this SBOM format."); + logger.Warning("Relationships array are not supported on this SBOM format."); return false; } }