Handle merge conflict error
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
This commit is contained in:
parent
497a915a46
commit
5d2378dc1d
1 changed files with 6 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package update
|
|||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/MakeNowJust/heredoc"
|
||||
"github.com/cli/cli/v2/api"
|
||||
|
|
@ -122,6 +123,11 @@ func updateRun(opts *UpdateOptions) error {
|
|||
err = updatePullRequestBranch(apiClient, repo, pr.ID, pr.HeadRefOid, opts.Rebase)
|
||||
opts.IO.StopProgressIndicator()
|
||||
if err != nil {
|
||||
// TODO: this is a best effort approach and not a resilient way of handling API errors.
|
||||
if strings.Contains(err.Error(), "GraphQL: merge conflict between base and head (updatePullRequestBranch)") {
|
||||
fmt.Fprintf(opts.IO.ErrOut, "%s Cannot update PR branch due to conflicts\n", cs.FailureIcon())
|
||||
return cmdutil.SilentError
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue