SIGN IN SIGN UP
payloadcms / payload UNCLAIMED

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.

0 0 16 TypeScript

docs: add info about custom errors via `APIError` to hooks overview (#13047)

<!--

Thank you for the PR! Please go through the checklist below and make
sure you've completed all the steps.

Please review the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository if you haven't already.

The following items will ensure that your PR is handled as smoothly as
possible:

- PR Title must follow conventional commits format. For example, `feat:
my new feature`, `fix(plugin-seo): my fix`.
- Minimal description explained as if explained to someone not
immediately familiar with the code.
- Provide before/after screenshots or code diffs if applicable.
- Link any related issues/discussions from GitHub or Discord.
- Add review comments if necessary to explain to the reviewer the logic
behind a change

-->

### What?

I was searching for info on how to return custom errors in hooks and
only came upon this discord answer by Dan Ribbons:

https://payloadcms.com/community-help/github/customize-rest-api-response-in-collection-hooks

### Why?

I think this info should be in the docs.

### How?

This PR adds a `Cusom Error Messages` section to the hooks-overview
page, detailing the usage of `APIError` as proposed by Dan Ribbons in
the above discord answer.

Co-authored-by: Paul Popus <paul@payloadcms.com>
C
codeflorist committed
d03054eb0c227a16d667c88135ea9e488a5bd8ec
Parent: 911f059
Committed by GitHub <noreply@github.com> on 4/2/2026, 3:53:48 PM