Skip to content

Commit fe28f34

Browse files
panic handling: add extension
1 parent 99b563f commit fe28f34

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

internal/exec/exec.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ type Request struct {
2828
func (r *Request) handlePanic(ctx context.Context) {
2929
if value := recover(); value != nil {
3030
r.Logger.LogPanic(ctx, value)
31-
r.AddError(makePanicError(value))
31+
if errs, ok := value.(*errors.QueryError); ok {
32+
r.AddError(errs)
33+
} else {
34+
r.AddError(makePanicError(value))
35+
}
3236
}
3337
}
3438

@@ -186,7 +190,11 @@ func execFieldSelection(ctx context.Context, r *Request, s *resolvable.Schema, f
186190
defer func() {
187191
if panicValue := recover(); panicValue != nil {
188192
r.Logger.LogPanic(ctx, panicValue)
189-
err = makePanicError(panicValue)
193+
if errs, ok := panicValue.(*errors.QueryError); ok {
194+
err = errs
195+
} else {
196+
err = makePanicError(panicValue)
197+
}
190198
err.Path = path.toSlice()
191199
}
192200
}()
@@ -334,7 +342,7 @@ func (r *Request) execList(ctx context.Context, sels []selected.Selection, typ *
334342
r.execSelectionSet(ctx, sels, typ.OfType, &pathSegment{path, i}, s, resolver.Index(i), &entryouts[i])
335343
}(i)
336344
}
337-
for i := 0; i < concurrency;i++ {
345+
for i := 0; i < concurrency; i++ {
338346
sem <- struct{}{}
339347
}
340348
} else {

0 commit comments

Comments
 (0)