Improve error messages #370

Merged
6543 merged 3 commits from noerw/tea:fix/367 into master 2021-07-03 14:39:05 +00:00
2 changed files with 10 additions and 2 deletions

View File

@ -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)

View File

@ -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