Repository navigation
fix(storage): normalize 404 status checks in ServiceObject - #9922
Open
thiyaguk09 wants to merge 4 commits into
Open
thiyaguk09 wants to merge 4 commits into
thiyaguk09 wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates error handling in ServiceObject to robustly extract status codes (such as 404 and 409) from different error properties (err.response.status, err.status, or err.code), accommodating newer error shapes like those in Gaxios v7. It also prevents duplicate callback invocations and adds comprehensive unit tests. The review feedback correctly identifies several TypeScript compilation issues where properties are accessed on Error | null or unknown types, and suggests casting them to inline types with optional properties or to Error to ensure type safety.
thiyaguk09
marked this pull request as ready for review
November 20, 2026 08:25
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Normalizes HTTP status code checks across
ServiceObjecterror handlers.Impact
Fixes 404 handling regressions when using injected
gaxiosv7 auth clients.Changes
handwritten/storage/src/nodejs-common/service-object.tsusingerr.response?.status ?? err.status ?? err.codeacrossdelete,exists, andget(autoCreate404 andonCreate409 paths).makeRequesterror handlers indeleteandgetMetadataso callbacks are not invoked twice whenStorageTransport.makeRequestboth triggers its callback and rejects its returned promise, while still honoringignoreNotFoundif the promise rejects directly.Testing
handwritten/storage/test/nodejs-common/service-object.tsto properly await completion viadone.err.codeanderr.response.status404/409 normalization (witherr.status === undefined) acrossdelete({ ignoreNotFound: true }),exists(), andget({ autoCreate: true }).StorageTransportwith an injectedauthClientthrowinggaxiosv7-shaped 404 errors.Fixes #9889