Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to modify graphql executor #149

Merged
merged 1 commit into from
Feb 24, 2025
Merged

allow to modify graphql executor #149

merged 1 commit into from
Feb 24, 2025

Conversation

jcbbb
Copy link
Contributor

@jcbbb jcbbb commented Feb 24, 2025

I need a way to modify graphql executor to setErrorPresenter of my own.

Copy link

cypress bot commented Feb 24, 2025

Default Project    Run #30

Run Properties:  status check failed Failed #30  •  git commit 5464f41f8d: Merge pull request #149 from iota-uz/modify_executor
Project Default Project
Branch Review main
Run status status check failed Failed #30
Run duration 00m 21s
Commit git commit 5464f41f8d: Merge pull request #149 from iota-uz/modify_executor
Committer Diyor Khaydarov
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 0
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/e2e/users/register.cy.js • 1 failed test

View Output

Test Artifacts
user auth and registration flow > creates a user and displays changes in users table Screenshots

@jcbbb jcbbb requested a review from diyor28 February 24, 2025 06:46
@jcbbb
Copy link
Contributor Author

jcbbb commented Feb 24, 2025

app.RegisterGraphSchema(application.GraphSchema{
    Value:    graph.NewExecutableSchema(config),
    BasePath: "/website",
    ExecutorCb: func (exec *executor.Executor) {
         exec.SetErrorPresenter(func(ctx context.Context, e error) *gqlerror.Error {
	    var appError *myCustomErr
	    err := graphql.DefaultErrorPresenter(ctx, e)
	    localizer, ok := LocalizerFromContext(ctx)
	    if !ok {
		return err
	    }
	    if errors.As(e, &myCustomErr) {
		err.Message = eai.ErrorMessage(appError, localizer)
	    }
	    return err
	})
    }
})

@diyor28 diyor28 merged commit 5464f41 into main Feb 24, 2025
2 checks passed
@diyor28 diyor28 deleted the modify_executor branch February 24, 2025 08:08
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