pronto icon indicating copy to clipboard operation
pronto copied to clipboard

Error handling when PR not found

Open panjan opened this issue 8 years ago • 2 comments

Hi,

When you run pronto run -f github_pr and Pronto::GitHub#pull returns nil (e.g. because you're on the wrong branch), the code execution continues. As a result, the following request to GitHub API fails with 404 Not Found because the request goes to /repos/{company}/{repo}/pulls/comments instead of /repos/{company}/{repo}/pulls/{id}/comments.

This situation occured in our CI build and it took me quite some time until I figured what was the source of the problem. IMHO it would be useful if, after not finding the PR, the program failed gracefully and gave an informative error message.

I'll be happy to submit a PR. Please let me know if you'd accept it.

panjan avatar Sep 06 '17 15:09 panjan

So the use case is: PULL_REQUEST_ID env var is not set, branch exists both locally and remotely but no PR is submitted for that branch? Returning informative message sounds reasonable to me.

mknapik avatar Sep 06 '17 18:09 mknapik

OK, I have a PR for this. Would be grateful for a review. Thanks! 🙏

panjan avatar Oct 01 '17 08:10 panjan