otter-space-sdk/internal/utils/error.go

17 lines
342 B
Go
Raw Normal View History

package utils
import (
"context"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
)
func HandleError(ctx context.Context, span trace.Span, logger *log.Entry, error error) error {
logger.Error(error)
span.RecordError(error)
span.SetStatus(codes.Error, error.Error())
return error
}