Skip to content
Snippets Groups Projects
Commit b1ee054a authored by rahix's avatar rahix
Browse files

Improve errors messages

parent 4aa151bf
Branches
No related tags found
No related merge requests found
......@@ -268,10 +268,10 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec
dec := toml.NewDecoder(reader)
err = dec.Decode(&data)
if err != nil {
return nil, fmt.Errorf("toml decode failed: %w", err)
return nil, fmt.Errorf("toml decode (%q) failed: %w", p, err)
}
if data.App.Name == "" || len(data.App.Name) > 32 {
return nil, fmt.Errorf("app name invalif")
return nil, fmt.Errorf("app name invalid (must be non-empty and <= 32 chars)")
}
sections := map[string]bool{
"Badge": true,
......@@ -279,16 +279,16 @@ func (s *server) parseAppToml(ctx context.Context, pathInRepo string, obj *objec
"Music": true,
}
if !sections[data.App.Menu] {
return nil, fmt.Errorf("app menu invalid")
return nil, fmt.Errorf("app menu invalid (must be one of 'Badge', 'Apps', 'Music')")
}
if data.Entry.Class == "" {
return nil, fmt.Errorf("no entry class")
}
if len(data.Metadata.Author) > 32 {
return nil, fmt.Errorf("metadata author too long")
return nil, fmt.Errorf("metadata author too long (must be <= 32 chars)")
}
if len(data.Metadata.Description) > 140 {
return nil, fmt.Errorf("metadata description too long")
return nil, fmt.Errorf("metadata description too long (must be <= 140 chars)")
}
return &appInfo{
......@@ -365,11 +365,11 @@ func (s *server) getAppInfo(ctx context.Context, pathInRepo, repo string) (*appI
}
if highsetVerNil {
return nil, fmt.Errorf("no version")
return nil, fmt.Errorf("no `version` field in `flow3r.toml`")
}
stars, err := s.getStars(ctx, repo)
if err != nil {
return nil, fmt.Errorf("getting stars failed: %w", err)
return nil, fmt.Errorf("getting gitlab stars failed: %w", err)
}
app := firstTime[highestVer]
app.stars = stars
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment