Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors.Code == "custom" when from Client.PullRequests.Create when PR already exists #1441

Open
jwtracy opened this issue Feb 26, 2020 · 3 comments

Comments

@jwtracy
Copy link

@jwtracy jwtracy commented Feb 26, 2020

Here is the ErrorsResponse.Error() output,

POST https://api.github.com/repos/***/***/pulls: 422 Validation Failed [{Resource:PullRequest Field: Code:custom Message:A pull request already exists for ***:***.}]

It would be convenient if Code:already_exists for Resource:PullRequest so I can use that rather than parsing the Message for "A pull request already exists"

Is it "custom" because the <owner>:<branch> string is not necessarily a unique key across Github? When creating a PR in a repository between two branches, this is a unique resource, however.

@gmlewis
Copy link
Collaborator

@gmlewis gmlewis commented Feb 27, 2020

Hmmm... looking at the code, it appears to me that this code is generated by the GitHub v3 API endpoint:
https://developer.github.com/v3/#client-errors

You might want to contact [email protected] and point them to:
https://developer.github.com/v3/pulls/#create-a-pull-request
and describe the problem like you did above, that you would like an already_exists error to be returned instead of a custom error in the situation you described.

If you do contact them, please report back here what they say. They are usually very fast to reply and are always friendly and helpful.

Thank you!

@elemanhillary
Copy link

@elemanhillary elemanhillary commented Mar 2, 2020

@gmlewis would you please assign this to me

@gmlewis
Copy link
Collaborator

@gmlewis gmlewis commented Mar 2, 2020

@elemanhillary - does that mean you want to contact GitHub tech support? There is nothing yet here to work on. Let's see if @jwtracy responds about contacting GitHub tech support first before I assign this ticket to anyone. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants