2024-08-11 20:34:28 +00:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-08-12 09:15:21 +00:00
|
|
|
|
2024-08-11 20:34:28 +00:00
|
|
|
log "github.com/sirupsen/logrus"
|
2024-08-12 09:15:21 +00:00
|
|
|
"go.opentelemetry.io/otel/codes"
|
2024-08-11 20:34:28 +00:00
|
|
|
"go.opentelemetry.io/otel/trace"
|
|
|
|
)
|
|
|
|
|
2024-08-12 09:15:21 +00:00
|
|
|
func HandleError(ctx context.Context, span trace.Span, logger *log.Entry, error error) error {
|
|
|
|
logger.Error(error)
|
2024-08-11 20:34:28 +00:00
|
|
|
span.RecordError(error)
|
2024-08-12 09:15:21 +00:00
|
|
|
span.SetStatus(codes.Error, error.Error())
|
2024-08-11 20:34:28 +00:00
|
|
|
return error
|
|
|
|
}
|