nidus-sync/db/errors.go
Eli Ribble 97ec2c767d
Big checkpoint on new schema work
I have to checkpoint this because I'm trying to get a very complicated
multi-layered SQL query for inserting version history into the database
and I need to improve it iteratively

I've got a new binary that I can use to directly test complex stored
procedures. This is to shorted my testing loop.
2025-12-02 22:12:43 +00:00

26 lines
514 B
Go

package db
import (
"errors"
"reflect"
"github.com/rs/zerolog/log"
)
func LogErrorTypeInfo(err error) {
if err == nil {
log.Error().Msg("Error is nil")
return
}
// Log current error type
errType := reflect.TypeOf(err)
log.Warn().Err(err).Str("type", errType.String()).Str("pkgPath", errType.PkgPath()).Msg("Error type info")
// Recursively log wrapped errors
wrappedErr := errors.Unwrap(err)
if wrappedErr != nil {
log.Info().Msg("Contains wrapped error")
LogErrorTypeInfo(wrappedErr)
}
}