1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-18 08:26:38 +02:00

Registry service: return not found error

This commit is contained in:
Ben Toogood 2020-05-14 19:38:56 +01:00
parent 331ab3715c
commit 0d7250352f

View File

@ -7,6 +7,7 @@ import (
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/client/grpc"
"github.com/micro/go-micro/v2/errors"
"github.com/micro/go-micro/v2/registry"
pb "github.com/micro/go-micro/v2/registry/service/proto"
)
@ -116,7 +117,9 @@ func (s *serviceRegistry) GetService(name string, opts ...registry.GetOption) ([
Service: name,
}, s.callOpts()...)
if err != nil {
if verr, ok := err.(*errors.Error); ok && verr.Code == 404 {
return nil, registry.ErrNotFound
} else if err != nil {
return nil, err
}