graphql-hive / graphql-hive/envelop

Plugin API: Allow to short-circuit and fall back to `ExecutionResult`

Open
#359 1 comment 0 reactions 0 assignees View on GitHub
kind/enhancement
Dominant language
No language data
Stars
827
Forks
132
PR merge metrics
No merged PRs in 30d

Description

I think maybe we can have an API that allow phases that happens before `execute` to do short-circuit and then other steps and being skipped and `execute` returns `ExecutionResult` with the custom error.

For example:
- `parse` do short-circuit with the parsing error
- `validate` skipped (0 errors)
- `contextFactory` skipped
- `rootValue` skipped
- `execute` is not being called and returns the parsing error from `parse` phase as `{ data: undefined, errors: [THE_ERROR] }`

Rough draft: https://github.com/dotansimha/envelop/pull/358

This should allow developers to intercept parse/validate errors using `useErorrHandler` and similar plugins, and also simplify some aspects of the request pipeline.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.