Repository navigation
feat(sdk): add proper error handling - #15143
Merged
Merged
Conversation
AlessioGr
commented
Jan 9, 2026
| } & Partial<BusboyConfig> | ||
|
|
||
| export type ErrorResult = { data?: any; errors: unknown[]; stack?: string } | ||
| export type ErrorResult = { |
Member
Author
There was a problem hiding this comment.
Type was too generic before
AlessioGr
commented
Jan 9, 2026
| } | ||
| } catch { | ||
| return response.json() | ||
| } catch (err) { |
Member
Author
There was a problem hiding this comment.
The remaining try { } catch { } es are only there to support disableErrors.
AlessioGr
commented
Jan 9, 2026
|
|
||
| const response = await this.fetch(`${this.baseURL}${path}${buildSearchParams(args)}`, init) | ||
|
|
||
| if (!response.ok) { |
Member
Author
There was a problem hiding this comment.
Central error handling right here. That way, we don't need to check for response.ok in every single operation.
AlessioGr
enabled auto-merge (squash)
January 9, 2026 02:14
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖 |
AlessioGr
changed the base branch from
main
to
feat/drizzle-validation-error-slugs
January 9, 2026 05:03
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.
DO NOT MERGE BEFORE #15147
Fixes #14495
The SDK now throws a proper
PayloadSDKErrorclass on failed API requests instead of either returning undefined or a genericError. Error handling is centralized in therequest()method, which adds error handling for operations where it was previously missing (likecreate,update,delete,find, etc.).Changes:
PayloadSDKErrorclass withstatus,errors,response, andmessagepropertiesrequest()- all operations now properly throw on failed responses. Previously, some operations (likefindByID) just threw a generic Error that did not explain what actually went wrong and some operations (likecreate) did not throw an error at all and simply returned undefined.Usage: