mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-28 13:24:13 +01:00
[API] Add error messages to dispatch API
- Add a error messages to the dispatch
API (https://code.forgejo.org/api/swagger#/repository/DispatchWorkflow)
when incorrect values are given. Otherwise an incorrect error message is
shown to the user.
- Relevant https://codeberg.org/forgejo/forgejo/issues/4765#issuecomment-2125392
(cherry picked from commit db78a3abed
)
This commit is contained in:
parent
966a354806
commit
f45a1a9af7
1 changed files with 2 additions and 2 deletions
|
@ -621,10 +621,10 @@ func DispatchWorkflow(ctx *context.APIContext) {
|
||||||
name := ctx.Params("workflowname")
|
name := ctx.Params("workflowname")
|
||||||
|
|
||||||
if len(opt.Ref) == 0 {
|
if len(opt.Ref) == 0 {
|
||||||
ctx.Error(http.StatusBadRequest, "ref", nil)
|
ctx.Error(http.StatusBadRequest, "ref", "ref is empty")
|
||||||
return
|
return
|
||||||
} else if len(name) == 0 {
|
} else if len(name) == 0 {
|
||||||
ctx.Error(http.StatusBadRequest, "workflowname", nil)
|
ctx.Error(http.StatusBadRequest, "workflowname", "workflow name is empty")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue