Skip to content

Commit

Permalink
Merge pull request #4805 from rtfd/humitos/integrations/handle-error-…
Browse files Browse the repository at this point in the history
…codes

Handle 401, 403 and 404 status codes when hitting GitHub for webhook
  • Loading branch information
ericholscher authored Jan 10, 2019
2 parents 78e5b7a + 2ae1c26 commit 392ff56
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions readthedocs/oauth/services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ def setup_webhook(self, project):
log.info('GitHub webhook creation successful for project: %s',
project)
return (True, resp)

if resp.status_code in [401, 403, 404]:
log.info(
'GitHub project does not exist or user does not have '
'permissions: project=%s',
project,
)
return (False, resp)
# Catch exceptions with request or deserializing JSON
except (RequestException, ValueError):
log.exception(
Expand Down

0 comments on commit 392ff56

Please sign in to comment.