Add 404 exception handling in BlobPayloadStore.DownloadAsync#534
Add 404 exception handling in BlobPayloadStore.DownloadAsync#534YunchuWang merged 6 commits intomainfrom
Conversation
…ner existence first Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
…adAsync Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
YunchuWang
left a comment
There was a problem hiding this comment.
verified locally change work as expected, signing off
There was a problem hiding this comment.
Pull request overview
This PR improves error diagnostics in the Azure Blob Storage payload store by adding specific exception handling for 404 (Not Found) errors during payload download operations. While the reported issue mentions warnings during PurgeAllInstancesAsync, the PR author notes those likely originate from the backend storage provider (Microsoft.Azure.DurableTask.AzureStorage), not this SDK. Nevertheless, this change enhances diagnostics for the large payload externalization path.
Key Changes:
- Added try-catch block in
BlobPayloadStore.DownloadAsyncto catchRequestFailedExceptionwith 404 status - Re-throws as
InvalidOperationExceptionwith descriptive error message including blob name and container context - Preserves original exception as inner exception for debugging purposes
| catch (RequestFailedException ex) when (ex.Status == (int)HttpStatusCode.NotFound) | ||
| { | ||
| using GZipStream decompressed = new(contentStream, CompressionMode.Decompress); | ||
| using StreamReader reader = new(decompressed, Encoding.UTF8); | ||
| return await ReadToEndAsync(reader, cancellationToken); | ||
| throw new InvalidOperationException( | ||
| $"The blob '{name}' was not found in container '{container}'. " + | ||
| "The payload may have been deleted or the container was never created.", | ||
| ex); | ||
| } |
There was a problem hiding this comment.
The new exception handling logic for 404 errors in DownloadAsync lacks test coverage. Consider adding a test that verifies:
- A RequestFailedException with 404 status is properly caught
- The resulting InvalidOperationException contains the expected error message with blob name and container
- The original RequestFailedException is preserved as the inner exception
This would ensure the error handling behavior is maintained across future changes.
Improves error handling when downloading large payloads from blob storage by catching 404 errors and providing descriptive exceptions.
Note: The reported 404 warnings during
PurgeAllInstancesAsynclikely originate fromMicrosoft.Azure.DurableTask.AzureStorage(the backend storage provider), not this SDK. However, this change improves diagnostics for the large payload externalization path.Changes
RequestFailedExceptionwith 404 status inDownloadAsyncInvalidOperationExceptionwith blob/container contextWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
http://crl3.digicert.com:443/DigiCertCSRSA4096RootG5.crl/usr/bin/dotnet dotnet restore rgo/bin/grep grep -l(http block)http://crl3.digicert.com:443/DigiCertTrustedG4TimeStampingRSA4096SHA2562025CA1.crl/usr/bin/dotnet dotnet restore rgo/bin/grep grep -l(http block)http://crl3.digicert.com:443/NETFoundationProjectsCodeSigningCA2.crl/usr/bin/dotnet dotnet restore rgo/bin/grep grep -l(http block)http://crl3.digicert.com:443/sha2-assured-ts.crl/usr/bin/dotnet dotnet restore rgo/bin/grep grep -l(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.