Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

fix: Don't throw an error for null inputs to the save function#1361

Closed
danieljbruce wants to merge 4 commits intomainfrom
index-exclusion-problem-statement
Closed

fix: Don't throw an error for null inputs to the save function#1361
danieljbruce wants to merge 4 commits intomainfrom
index-exclusion-problem-statement

Conversation

@danieljbruce
Copy link
Copy Markdown
Contributor

@danieljbruce danieljbruce commented Nov 20, 2024

Summary:

This PR fixes issue #1327.

Background:

Taken directly from this PR

Changes:

src/entity.ts: A couple of lines have been added that prevent errors from being thrown when array or entity is null or undefined. This change may not make the save function perfect and is a sign there may be more work to perfect the save function, but it is clearly an improvement because now code will work for certain inputs that used to throw useless errors.

test/entity.ts: A test has been added that throws an error and fails without the new changes to src/entity.ts. In this test, excludeFromIndexes: true is always in the right place.

Next steps:

The save function was broken down here, but for the save function to work properly for every possible input, more edge cases for special cases with nulls, undefined values and other unique values passed into the save function should be explored.

@product-auto-label product-auto-label bot added size: s Pull request size is small. api: datastore Issues related to the googleapis/nodejs-datastore API. labels Nov 20, 2024
@danieljbruce danieljbruce changed the title Index exclusion problem statement fix: Don't throw an error for null inputs to the save function Nov 20, 2024
@danieljbruce danieljbruce marked this pull request as ready for review November 20, 2024 18:01
@danieljbruce danieljbruce requested a review from a team November 20, 2024 18:01
@danieljbruce danieljbruce requested a review from a team as a code owner November 20, 2024 18:01
@danieljbruce danieljbruce added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 20, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 20, 2024
@product-auto-label product-auto-label bot added size: u Pull request is empty. and removed size: s Pull request size is small. labels Nov 20, 2024
@kevkim-codes kevkim-codes added the automerge Merge the pull request once unit tests and other checks pass. label Nov 20, 2024
@danieljbruce
Copy link
Copy Markdown
Contributor Author

The checks finally passed for the copied PR so merging that instead.

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Nov 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: datastore Issues related to the googleapis/nodejs-datastore API. size: u Pull request is empty.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants