Merge pull request #1639 from micro/registy-not-found

Registry service: return not found error
This commit is contained in:
ben-toogood 2020-05-14 19:43:19 +01:00 committed by GitHub
commit f64b1468a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import (
"github.com/micro/go-micro/v2/client" "github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/client/grpc" "github.com/micro/go-micro/v2/client/grpc"
"github.com/micro/go-micro/v2/errors"
"github.com/micro/go-micro/v2/registry" "github.com/micro/go-micro/v2/registry"
pb "github.com/micro/go-micro/v2/registry/service/proto" pb "github.com/micro/go-micro/v2/registry/service/proto"
) )
@ -120,7 +121,9 @@ func (s *serviceRegistry) GetService(name string, opts ...registry.GetOption) ([
Service: name, Service: name,
}, s.callOpts()...) }, 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 return nil, err
} }