Skip to content

feat: add missing disableErrors to globals findOne operation#14913

Merged
paulpopus merged 1 commit intopayloadcms:mainfrom
rilrom:feat/add-missing-disable-errors-option
Apr 2, 2026
Merged

feat: add missing disableErrors to globals findOne operation#14913
paulpopus merged 1 commit intopayloadcms:mainfrom
rilrom:feat/add-missing-disable-errors-option

Conversation

@rilrom
Copy link
Copy Markdown
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 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 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
@rilrom rilrom force-pushed the feat/add-missing-disable-errors-option branch from 8128105 to ebd6d08 Compare February 10, 2026 11:10
@paulpopus paulpopus merged commit c8332e7 into payloadcms:main Apr 2, 2026
149 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

🚀 This is included in version v3.82.0

milamer pushed a commit to milamer/payload that referenced this pull request Apr 20, 2026
…cms#14913)

### 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](https://discord.com/channels/967097582721572934/1102950643259424828/1438504179961430059).
- A [PR](payloadcms#6357) 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.
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.

3 participants