Skip to content

Commit

Permalink
fix: wrap errors in auto CLI service registration (#20493)
Browse files Browse the repository at this point in the history
Co-authored-by: Marko <[email protected]>
  • Loading branch information
mark-rushakoff and tac0turtle authored May 31, 2024
1 parent b13e5cb commit 0256369
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions runtime/v2/services/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package services

import (
"context"
"fmt"

"github.com/cosmos/gogoproto/proto"
"google.golang.org/grpc"
Expand Down Expand Up @@ -104,11 +105,16 @@ type autocliRegistrar struct {
func (a *autocliRegistrar) RegisterService(sd *grpc.ServiceDesc, ss interface{}) {
if a.registryCache == nil {
a.registryCache, a.err = proto.MergedRegistry()
if a.err != nil {
a.err = fmt.Errorf("failed to build registry cache: %w", a.err)
return
}
}

desc, err := a.registryCache.FindDescriptorByName(protoreflect.FullName(sd.ServiceName))
fullName := protoreflect.FullName(sd.ServiceName)
desc, err := a.registryCache.FindDescriptorByName(fullName)
if err != nil {
a.err = err
a.err = fmt.Errorf("failed to find descriptor for %q: %w", fullName, err)
return
}

Expand Down

0 comments on commit 0256369

Please sign in to comment.