Skip to content

Conversation

@rilrom
Copy link
Contributor

@rilrom rilrom commented Dec 13, 2025

What?

This PR introduces the disableErrors option into the global findOne operation.

Why?

disableErrors is handy for certain flows where a user may be unauthorised but you don't need an error to be thrown, instead you would prefer an empty result.

Without this, the developer needs to catch the error themselves, leading to inconsistencies as some operations have disableErrors and others do not.

How?

Introduced the disableErrors option to the global findOne operation.

Additional information

  • Initial discord discussion.
  • There is opportunity here to include disableErrors in a number of operations that seem to be lacking it, especially in the sdk package. Originally I included these changes in this PR but have since removed to instead allow for some discussion before we consider introducing them in a separate PR.
  • In packages/payload/src/collections/operations/restoreVersion.ts, disableErrors exists in the types but is not actually implemented. I have left this as is for now but wanted to flag it.

@rilrom rilrom force-pushed the feat/add-missing-disable-errors-option branch from 9cb8085 to 21d54f0 Compare December 13, 2025 11:02
@rilrom rilrom marked this pull request as draft December 13, 2025 11:09
@rilrom
Copy link
Contributor Author

rilrom commented Dec 13, 2025

Converting to draft until I have time to resolve build errors.

@rilrom rilrom force-pushed the feat/add-missing-disable-errors-option branch 2 times, most recently from 23a56d3 to 155c769 Compare December 13, 2025 22:27
@rilrom rilrom changed the title feat: add missing disableErrors to globals and sdk operations feat(payload): add missing disableErrors to globals findOne operation Dec 13, 2025
@rilrom rilrom changed the title feat(payload): add missing disableErrors to globals findOne operation feat: add missing disableErrors to globals findOne operation Dec 13, 2025
@rilrom rilrom force-pushed the feat/add-missing-disable-errors-option branch from 155c769 to 9ebdc43 Compare December 14, 2025 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant