payloadcms / payload

The best way to build a modern backend + admin UI. No black magic, all TypeScript, and fully open-source, Payload is both an app framework and a headless CMS.
https://payloadcms.com
MIT License
21.1k stars 1.27k forks source link

Errors given by local api do not match exported errors #6960

Open Arctomachine opened 6 days ago

Arctomachine commented 6 days ago

Link to reproduction

https://github.com/Arctomachine/payload-error-bug-v3

Payload Version

3.0.0-beta.55

Node Version

20.12.2

Next.js Version

15.0.0.-rc.0

Describe the Bug

Errors returned from payload.find and other methods do not match errors exported from payload. In v2 same errors are exported from payload/errors and they match returned errors.

Reproduction Steps

Start server and open home page, look at server console.

Constructor name: NotFound
Instance of NotFound false

Uncomment lines 18 and 19 in page.tsx (override access and user)

Constructor name: Forbidden
Instance of Forbidden false

Adapters and Plugins

No response