mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 18:08:30 +02:00
Refactor error handling (#308)
use fmt instead of log log.Fatal -> return err set non-zero exit code on error print to default err log cleanup fix vet Co-authored-by: Norwin Roosen <git@nroo.de> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/308 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: 6543 <6543@obermui.de> Co-Authored-By: Norwin <noerw@noreply.gitea.io> Co-Committed-By: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
@ -80,11 +80,7 @@ func runLabelCreate(cmd *cli.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
func splitLabelLine(line string) (string, string, string) {
|
||||
|
@ -5,8 +5,6 @@
|
||||
package labels
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"code.gitea.io/tea/modules/context"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
@ -31,9 +29,5 @@ func runLabelDelete(cmd *cli.Context) error {
|
||||
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||
|
||||
_, err := ctx.Login.Client().DeleteLabel(ctx.Owner, ctx.Repo, ctx.Int64("id"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
@ -5,8 +5,6 @@
|
||||
package labels
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"code.gitea.io/tea/cmd/flags"
|
||||
"code.gitea.io/tea/modules/context"
|
||||
"code.gitea.io/tea/modules/print"
|
||||
@ -44,7 +42,7 @@ func RunLabelsList(cmd *cli.Context) error {
|
||||
ListOptions: ctx.GetListOptions(),
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return err
|
||||
}
|
||||
|
||||
if ctx.IsSet("save") {
|
||||
|
@ -5,8 +5,6 @@
|
||||
package labels
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"code.gitea.io/tea/modules/context"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
@ -68,7 +66,7 @@ func runLabelUpdate(cmd *cli.Context) error {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user