Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Psentee
API
Commits
b1ee054a
Commit
b1ee054a
authored
1 year ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
Improve errors messages
parent
4aa151bf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
server_apps.go
+7
-7
7 additions, 7 deletions
server_apps.go
with
7 additions
and
7 deletions
server_apps.go
+
7
−
7
View file @
b1ee054a
...
...
@@ -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 invali
f
"
)
return
nil
,
fmt
.
Errorf
(
"app name invali
d (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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment