From 1d7b9b9765c65b304c234f6e4b532b3aa980933c Mon Sep 17 00:00:00 2001 From: Rahix <rahix@rahix.de> Date: Fri, 18 Aug 2023 15:18:26 +0200 Subject: [PATCH] Show first error instead of last when no working version is published yet --- server_apps.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server_apps.go b/server_apps.go index bd702c1..4ff8e0b 100644 --- a/server_apps.go +++ b/server_apps.go @@ -343,6 +343,7 @@ func (s *server) getAppInfo(ctx context.Context, pathInRepo, repo string) (*appI highestVer := 0 highsetVerNil := true firstTime := make(map[int]*appInfo) + var firstErr error = nil for { info, err := s.parseAppToml(ctx, pathInRepo, obj) if err == nil { @@ -354,6 +355,9 @@ func (s *server) getAppInfo(ctx context.Context, pathInRepo, repo string) (*appI } } else { log.Printf("%s@%s: %v", repo, obj.Hash.String(), err) + if firstErr == nil { + firstErr = err + } } if len(obj.ParentHashes) == 0 { break @@ -365,6 +369,9 @@ func (s *server) getAppInfo(ctx context.Context, pathInRepo, repo string) (*appI } if highsetVerNil { + if firstErr != nil { + return nil, firstErr + } return nil, fmt.Errorf("no `version` field in `flow3r.toml`") } stars, err := s.getStars(ctx, repo) -- GitLab