chore: handle resource not found

This commit is contained in:
Steven
2024-01-20 12:47:43 +08:00
parent 89d940d9b7
commit d5f874e185
3 changed files with 18 additions and 4 deletions

View File

@@ -73,6 +73,9 @@ func (s *APIV2Service) GetResource(ctx context.Context, request *apiv2pb.GetReso
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to list resources: %v", err)
}
if resource == nil {
return nil, status.Errorf(codes.NotFound, "resource not found")
}
return &apiv2pb.GetResourceResponse{
Resource: s.convertResourceFromStore(ctx, resource),