Skip to content

Commit

Permalink
fix: user srv err message
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Dec 30, 2023
1 parent dbd6fa1 commit 23c69ce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/internal/service/user/user.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (s *serviceImpl) FindOne(_ context.Context, request *proto.FindOneUserReque

err := s.repo.FindById(request.Id, &raw)
if err != nil {
return nil, status.Error(codes.Internal, constant.InternalServerErrorMessage)
return nil, status.Error(codes.Internal, "Find one user failed")
}

return &proto.FindOneUserResponse{User: RawToDto(&raw)}, nil
Expand All @@ -53,7 +53,7 @@ func (s *serviceImpl) Update(_ context.Context, request *proto.UpdateUserRequest
if errors.Is(err, gorm.ErrDuplicatedKey) {
return nil, status.Error(codes.AlreadyExists, constant.DuplicateEmailErrorMessage)
}
return nil, status.Error(codes.Internal, constant.InternalServerErrorMessage)
return nil, status.Error(codes.Internal, "Update user failed")
}

return &proto.UpdateUserResponse{User: RawToDto(updateUser)}, nil
Expand All @@ -62,7 +62,7 @@ func (s *serviceImpl) Update(_ context.Context, request *proto.UpdateUserRequest
func (s *serviceImpl) Delete(_ context.Context, request *proto.DeleteUserRequest) (*proto.DeleteUserResponse, error) {
err := s.repo.Delete(request.Id)
if err != nil {
return nil, status.Error(codes.Internal, constant.InternalServerErrorMessage)
return nil, status.Error(codes.Internal, "Delete user failed")
}

return &proto.DeleteUserResponse{Success: true}, nil
Expand Down

0 comments on commit 23c69ce

Please sign in to comment.