mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-10-15 03:50:55 +08:00
18 lines
291 B
Go
18 lines
291 B
Go
package observability
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/facebookincubator/go-belt"
|
|
"github.com/facebookincubator/go-belt/tool/experimental/errmon"
|
|
)
|
|
|
|
func PanicIfNotNil(ctx context.Context, r any) {
|
|
if r == nil {
|
|
return
|
|
}
|
|
errmon.ObserveRecoverCtx(ctx, r)
|
|
belt.Flush(ctx)
|
|
panic(r)
|
|
}
|