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.
  • A PR was created to address this in mid 2024 but was later closed.
  • 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.
  • There is opportunity to introduce better test coverage in a separate PR for disableErrors across existing operations that use it.
  • 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 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 Dec 13, 2025
@rilrom rilrom changed the title feat(payload): add missing disableErrors to globals findOne operation Dec 13, 2025
@rilrom rilrom force-pushed the feat/add-missing-disable-errors-option branch 2 times, most recently from 9ebdc43 to c9dea01 Compare December 14, 2025 08:42
@rilrom rilrom marked this pull request as ready for review December 14, 2025 09:19
@rilrom rilrom force-pushed the feat/add-missing-disable-errors-option branch from c9dea01 to 8128105 Compare December 21, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant