From fe76efde750352c5a160970139f476ca6200c561 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 2 Mar 2022 10:38:30 +0000 Subject: [PATCH] return not found when user is nil --- user/handler/handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user/handler/handler.go b/user/handler/handler.go index c4f613b..3c562f8 100644 --- a/user/handler/handler.go +++ b/user/handler/handler.go @@ -174,6 +174,10 @@ func (s *User) Read(ctx context.Context, req *pb.ReadRequest, rsp *pb.ReadRespon account, err = s.domain.SearchByEmail(ctx, req.Email) } + if account == nil { + return errors.NotFound("user.read", "user not found") + } + rsp.Account = account if err != nil { return err