Unverified Commit 2c819ace authored by Ryo's avatar Ryo Committed by GitHub

feat: return not found error instead internal error for local file not exist (#3543)

* chore: add `/.vscode` to `.gitignore`

* feat: return not found instead of internal for resource

* feat: check file not exist only if error not nil
parent e4a09c40
......@@ -23,3 +23,6 @@ bin/air
dev-dist
dist
# VSCode settings
/.vscode
......@@ -198,6 +198,9 @@ func (s *APIV1Service) GetResourceBinary(ctx context.Context, request *v1pb.GetR
file, err := os.Open(resourcePath)
if err != nil {
if os.IsNotExist(err) {
return nil, status.Errorf(codes.NotFound, "file not found for resource: %s", request.Name)
}
return nil, status.Errorf(codes.Internal, "failed to open the file: %v", err)
}
defer file.Close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment