Skip to content

feat(gqlerrors): support multiple errors from resolver via errors.Join#53

Merged
haru0017 merged 1 commit intomainfrom
feat/support-multiple-errors-from-resolver
Feb 24, 2026
Merged

feat(gqlerrors): support multiple errors from resolver via errors.Join#53
haru0017 merged 1 commit intomainfrom
feat/support-multiple-errors-from-resolver

Conversation

@haru0017
Copy link
Contributor

Issue

N/A

TL; DR

  • Enable resolvers to return multiple GraphQL errors using errors.Join

Task summary / Change details

  • Add FormatErrorsFromError function in gqlerrors/formatted.go to expand joined errors
  • Update handleFieldError in executor.go to use the new function
  • Add tests for multiple errors and nested joined errors

Usage:

func resolve(p graphql.ResolveParams) (interface{}, error) {
    err1 := errors.New("first error")
    err2 := errors.New("second error")
    return nil, errors.Join(err1, err2)
}

Result:

{
  "errors": [
    {"message": "first error", "path": ["field"]},
    {"message": "second error", "path": ["field"]}
  ]
}

Backward compatible - single errors work as before.

@haru0017 haru0017 self-assigned this Feb 20, 2026
@haru0017 haru0017 marked this pull request as ready for review February 20, 2026 08:38
@haru0017 haru0017 requested a review from a team as a code owner February 20, 2026 08:38
Copy link
Contributor

@k1LoW k1LoW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GREAT! LTGM!

@haru0017 haru0017 merged commit 7ca75d9 into main Feb 24, 2026
1 check passed
@haru0017 haru0017 deleted the feat/support-multiple-errors-from-resolver branch February 24, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants