5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-12-28 05:35:40 +00:00
matterbridge/vendor/github.com/graph-gophers/graphql-go/errors/panic_handler.go
2022-04-01 00:23:19 +02:00

19 lines
560 B
Go

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)
}