Skip to content

blob/azureblob: improve error handling#3636

Merged
vangent merged 3 commits intogoogle:masterfrom
SoMuchForSubtlety:azure-blob-more-correct
Nov 10, 2025
Merged

blob/azureblob: improve error handling#3636
vangent merged 3 commits intogoogle:masterfrom
SoMuchForSubtlety:azure-blob-more-correct

Conversation

@SoMuchForSubtlety
Copy link
Contributor

@SoMuchForSubtlety SoMuchForSubtlety commented Nov 5, 2025

Follow-up for #3635

This cleans up the error handling and removes code duplication.

Copy link
Contributor

@vangent vangent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't tell if this is an improvement or not, and I no longer have the ability to run tests, so I'd rather not accept it.

If you want to add a specific check to map an error better, I'm likely to be OK with that.

@SoMuchForSubtlety SoMuchForSubtlety force-pushed the azure-blob-more-correct branch 2 times, most recently from dc184e3 to 0ef815c Compare November 5, 2025 18:50
- remove duplicated checks
- add additional handling for precondition errors
Copy link
Contributor

@vangent vangent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure your latest changes addressed my comment.

For example, why are you removing the "bloberror.HasCode" calls? It's not obvious to me whether those are exactly the same as the lower checks (otherwise why would they have been made separate to begin with?).

I think you are just adding mappings for TargetConditionNotMet and SourceConditionNotMet, can you restrict your PR to adding those?

If you want to do a separate refactor that doesn't change any behavior, do that in a separate PR and explain in detail why the behavior doesn't change. Again, I no longer have the ability to run tests against Azure, so my bar for ensuring we're not breaking it is super high.

@SoMuchForSubtlety
Copy link
Contributor Author

SoMuchForSubtlety commented Nov 5, 2025

For example, why are you removing the "bloberror.HasCode" calls? It's not obvious to me whether those are exactly the same as the lower checks (otherwise why would they have been made separate to begin with?).

The duplications were introduced during a migration to a newer client version1. They seem to be accidental. If you look at the implementation of HasCode2, you will see that it is equivalent to the check we now use.

If you want to do a separate refactor that doesn't change any behavior, do that in a separate PR and explain in detail why the behavior doesn't change. Again, I no longer have the ability to run tests against Azure, so my bar for ensuring we're not breaking it is super high.

Sure, I'm fine with creating a separate PR.

I'll also run the conformance tests against azure to make sure there is no breakage.

Footnotes

  1. https://github.com/google/go-cloud/commit/e1a8e6f0c1d3ba55d8839194b16e0674d519f731#diff-9ee8a1ad2dadc385fec784185cfeacacb8796a02b4da3b576dfe5e3a9346d753R630-R653

  2. https://github.com/Azure/azure-sdk-for-go/blob/c0ac8eac0bcf293604a62be6c222981953f01c49/sdk/storage/azblob/bloberror/error_codes.go#L18-L31

@SoMuchForSubtlety
Copy link
Contributor Author

I've removed the handling for additional errors codes and will create a separate PR for it.

Copy link
Contributor

@vangent vangent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert the addition of TestIfNotExist.replay? I don't see any code change in the PR that adds a new test.

@SoMuchForSubtlety
Copy link
Contributor Author

Can you revert the addition of TestIfNotExist.replay? I don't see any code change in the PR that adds a new test.

The test is defined here, but never ran because running against real azure infra in tests is currently disabled.

I re-enabled this locally to get this recording. From now on the test in question can run via this recording, even if no azure credentials are present.

I can also split this into a separate PR if you would prefer that.

@vangent
Copy link
Contributor

vangent commented Nov 10, 2025

Ah yes, got it! Thanks.

@vangent vangent merged commit dfa0635 into google:master Nov 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants