mirror of
https://gitea.com/gitea/tea.git
synced 2024-12-22 09:05:06 +01:00
Improve error messages (#370)
fixes #367 Co-authored-by: Norwin Roosen <git@nroo.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/tea/pulls/370 Reviewed-by: 6543 <6543@obermui.de> Reviewed-by: KN4CK3R <kn4ck3r@noreply.gitea.io> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
parent
64770a771f
commit
2bdd72dfff
@ -123,8 +123,16 @@ func InitCommand(ctx *cli.Context) *TeaContext {
|
||||
}
|
||||
} else if c.Login == nil {
|
||||
if c.Login, err = config.GetDefaultLogin(); err != nil {
|
||||
log.Fatal(err.Error())
|
||||
if err.Error() == "No available login" {
|
||||
// TODO: maybe we can directly start interact.CreateLogin() (only if
|
||||
// we're sure we can interactively!), as gh cli does.
|
||||
fmt.Println(`No gitea login configured. To start using tea, first run
|
||||
tea login add
|
||||
and then run your command again.`)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("NOTE: no gitea login detected, falling back to login '%s'\n", c.Login.Name)
|
||||
}
|
||||
|
||||
// parse reposlug (owner falling back to login owner if reposlug contains only repo name)
|
||||
|
@ -28,7 +28,7 @@ func PullCheckout(
|
||||
client := login.Client()
|
||||
pr, _, err := client.GetPullRequest(repoOwner, repoName, index)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("couldn't fetch PR: %s", err)
|
||||
}
|
||||
if err := workaround.FixPullHeadSha(client, pr); err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user