useErrorHandler

This plugin triggers a custom function when execution encounters an error.

Weekly downloads
5.6M
Version
5.6.0
License
MIT
Updated
Aug 19, 2026

coreerrors

useErrorHandler

This plugin triggers a custom function when execution encounters an error.

import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine, useErrorHandler } from '@envelop/core'

const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    useErrorHandler((errors, args) => {
      // This callback is called once, containing all GraphQLError emitted during execution phase
    })
    // ... other plugins ...
  ]
})