Log failed resolve attempts in fallbackResolver
parent
1038ca3bea
commit
8b89a1544e
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/bluesky-social/indigo/api"
|
||||
"github.com/bluesky-social/indigo/did"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
var Resolver did.Resolver
|
||||
|
@ -36,11 +37,14 @@ type fallbackResolver struct {
|
|||
}
|
||||
|
||||
func (r *fallbackResolver) GetDocument(ctx context.Context, didstr string) (*did.Document, error) {
|
||||
log := zerolog.Ctx(ctx)
|
||||
errs := []error{}
|
||||
for _, res := range r.resolvers {
|
||||
if d, err := res.GetDocument(ctx, didstr); err == nil {
|
||||
return d, nil
|
||||
} else {
|
||||
log.Warn().Err(err).Str("plc", res.(*api.PLCServer).Host).
|
||||
Msgf("Failed to resolve %q using %q: %s", didstr, res.(*api.PLCServer).Host, err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue