Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 4 commits into from

Conversation

danieljbruce
Copy link
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 review from a team as code owners 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
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 join this conversation on GitHub. Already have an account? Sign in to comment
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