Remove redundant API error type, use arcgis
That's what the library is supposed to be for. Errors still aren't working quite right.
This commit is contained in:
parent
e48abb09c0
commit
0614a768c3
3 changed files with 22 additions and 28 deletions
12
errors.go
12
errors.go
|
|
@ -2,27 +2,25 @@ package main
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
"reflect"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func LogErrorTypeInfo(err error) {
|
||||
if err == nil {
|
||||
slog.Info("Error is nil")
|
||||
log.Error().Msg("Error is nil")
|
||||
return
|
||||
}
|
||||
|
||||
// Log current error type
|
||||
errType := reflect.TypeOf(err)
|
||||
slog.Info("Error type info",
|
||||
"type", errType.String(),
|
||||
"pkgPath", errType.PkgPath(),
|
||||
"error", err.Error())
|
||||
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 {
|
||||
slog.Info("Contains wrapped error")
|
||||
log.Info().Msg("Contains wrapped error")
|
||||
LogErrorTypeInfo(wrappedErr)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue