Commit d03054e
docs: add info about custom errors via
<!--
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>APIError to hooks overview (#13047)1 parent 911f059 commit d03054e
1 file changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
130 | 146 | | |
131 | 147 | | |
132 | 148 | | |
| |||
0 commit comments