summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/graph-gophers/graphql-go/errors/panic_handler.go
blob: 5446c2a9c6caefb4309a450376c59988637a0048 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package errors

import (
	"context"
)

// PanicHandler is the interface used to create custom panic errors that occur during query execution
type PanicHandler interface {
	MakePanicError(ctx context.Context, value interface{}) *QueryError
}

// DefaultPanicHandler is the default PanicHandler
type DefaultPanicHandler struct{}

// MakePanicError creates a new QueryError from a panic that occurred during execution
func (h *DefaultPanicHandler) MakePanicError(ctx context.Context, value interface{}) *QueryError {
	return Errorf("panic occurred: %v", value)
}