Skip to content

Commit

Permalink
panic if operation context is missing when requested
Browse files Browse the repository at this point in the history
  • Loading branch information
vektah committed Nov 28, 2019
1 parent a13a0f5 commit 93a04e7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion graphql/context_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func GetOperationContext(ctx context.Context) *OperationContext {
if val, ok := ctx.Value(operationCtx).(*OperationContext); ok {
return val
}
return nil
panic("missing operation context")
}

func WithOperationContext(ctx context.Context, rc *OperationContext) context.Context {
Expand Down
2 changes: 0 additions & 2 deletions graphql/context_operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
)

func TestGetOperationContext(t *testing.T) {
require.Nil(t, GetOperationContext(context.Background()))

rc := &OperationContext{}
require.Equal(t, rc, GetOperationContext(WithOperationContext(context.Background(), rc)))
}
Expand Down

0 comments on commit 93a04e7

Please sign in to comment.