Capture panic in // runner and fwd to sentry

main
Elie 2021-01-06 09:56:42 +01:00
parent c564ba001f
commit 28b44e57d7
No known key found for this signature in database
GPG Key ID: 399AF69092C727B6
1 changed files with 2 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt"
"sync"
"github.com/getsentry/sentry-go"
"github.com/sirupsen/logrus"
"go.uber.org/atomic"
@ -89,6 +90,7 @@ func (p *ParallelRunner) Run(runnable func() (interface{}, error)) {
// Some failed call to grpc plugin like getSchema trigger a panic
defer func() {
if r := recover(); r != nil {
sentry.CurrentHub().Recover(r)
p.Stop(fmt.Errorf("A runner routine paniced: %s", r))
}
}()