Repository navigation
feat(drizzle): include collection and global slugs in validation errors - #15147
Merged
Merged
Conversation
AlessioGr
changed the base branch from
main
to
fix/drizzle-validation-errors-optimized
January 9, 2026 05:02
Fixes #14495 The SDK now throws a proper `PayloadSDKError` class on failed API requests instead of either returning undefined or a generic `Error`. Error handling is centralized in the `request()` method, which adds error handling for operations where it was previously missing (like `create`, `update`, `delete`, `find`, etc.). **Changes:** - Added `PayloadSDKError` class with `status`, `errors`, `response`, and `message` properties - Centralized error handling in `request()` - all operations now properly throw on failed responses. Previously, some operations (like `findByID`) just threw a generic Error that did not explain what actually went wrong and some operations (like `create`) did not throw an error at all and simply returned undefined. - Lots of new int tests **Usage:** ```ts import { PayloadSDKError } from '@payloadcms/sdk' try { await sdk.create({ collection: 'posts', data: { ... } }) } catch (err) { if (err instanceof PayloadSDKError) { console.log(err.status) // 400 console.log(err.errors) // [{ name: 'ValidationError', message: '...', data: {...} }] } } ```
This reverts commit 2d9deef.
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖 |
Base automatically changed from
fix/drizzle-validation-errors-optimized
to
main
January 9, 2026 07:57
AlessioGr
marked this pull request as ready for review
January 9, 2026 17:08
AlessioGr
enabled auto-merge (squash)
January 9, 2026 17:22
r1tsuu
previously approved these changes
Jan 9, 2026
r1tsuu
approved these changes
Jan 9, 2026
Contributor
|
🚀 This is included in version v3.71.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unique constraint
ValidationErrors now includedata.collectionordata.globalfor better error context.Changes:
collectionSlugandglobalSlugparameters toupsertRowhandleUpsertError→ValidationErrorcreate,updateOne,updateMany,updateJobs,createGlobal,updateGlobal,createVersion,updateVersion,createGlobalVersion,updateGlobalVersion,fetchAndResaveerror.data.collectionis populated