2fas-server/internal/common/recovery/recovery.go
2023-04-11 23:39:25 +02:00

21 lines
313 B
Go

package recovery
import (
"github.com/twofas/2fas-server/internal/common/logging"
)
func DoNotPanic(fn func()) {
defer func() {
if err := recover(); err != nil {
stack := stack(3)
logging.WithFields(logging.Fields{
"stack": string(stack),
"error": err,
}).Error("Panic")
}
}()
fn()
}