Not generated errors in logging #2160
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Details
Description / Motivation and Context
This pull request introduces enhancements to error handling and logging in the
ResizeThumbnailFromThumbnailImageHelper
class, along with corresponding updates to its test coverage. The most notable changes include the addition of a new helper method for error handling, improved error messages, and a new unit test to validate the error-handling behavior.Enhancements to error handling and logging:
SetError
method to centralize error handling, improving code readability and consistency. This method logs detailed error messages, including the file hash and subpath reference, and updates theGenerationResultModel
with appropriate error information. (ResizeThumbnailFromThumbnailImageHelper.cs
, starsky/starsky.foundation.thumbnailgeneration/GenerationFactory/ImageSharp/ResizeThumbnailFromThumbnailImageHelper.csL104-L122)ResizeThumbnailFromThumbnailImageHelper.cs
, starsky/starsky.foundation.thumbnailgeneration/GenerationFactory/ImageSharp/ResizeThumbnailFromThumbnailImageHelper.csR82-L86)Updates to test coverage:
SetError_ShouldSetErrorMessageAndLogException
, to verify that theSetError
method correctly sets error messages and logs exceptions. (ResizeThumbnailFromThumbnailImageHelperTests.cs
, starsky/starskytest/starsky.foundation.thumbnailgeneration/GenerationFactory/ImageSharp/ResizeThumbnailFromThumbnailImageHelperTests.csR108-R129)ResizeThumbnailFromThumbnailImage_FileNotFound
test to assert that the error message contains the expected text, ensuring alignment with the new error-handling logic. (ResizeThumbnailFromThumbnailImageHelperTests.cs
, starsky/starskytest/starsky.foundation.thumbnailgeneration/GenerationFactory/ImageSharp/ResizeThumbnailFromThumbnailImageHelperTests.csR82-R84)Minor adjustments:
using
directive for theGenerationResultModel
class in the test file to support the new test case. (ResizeThumbnailFromThumbnailImageHelperTests.cs
, starsky/starskytest/starsky.foundation.thumbnailgeneration/GenerationFactory/ImageSharp/ResizeThumbnailFromThumbnailImageHelperTests.csR11)Related Issue
How Has This Been Tested
Types of changes
Checklist