feat(chalice): handle Github bad credentials
This commit is contained in:
parent
d49ba14d82
commit
a93ac392f0
2 changed files with 6 additions and 3 deletions
|
|
@ -1,6 +1,9 @@
|
|||
import requests
|
||||
from datetime import datetime
|
||||
|
||||
from fastapi import HTTPException
|
||||
from starlette import status
|
||||
|
||||
|
||||
class github_formatters:
|
||||
|
||||
|
|
@ -120,9 +123,9 @@ class githubV3Request:
|
|||
pages = get_response_links(response)
|
||||
result = response.json()
|
||||
if response.status_code != 200:
|
||||
print("!-------- error")
|
||||
print(f"=>GITHUB Exception")
|
||||
print(result)
|
||||
raise Exception(result["message"])
|
||||
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=f"GITHUB: {result['message']}")
|
||||
if isinstance(result, dict):
|
||||
return result
|
||||
results += result
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class JiraManager:
|
|||
if (e.status_code // 100) == 4 and self.retries > 0:
|
||||
time.sleep(1)
|
||||
return self.get_projects()
|
||||
print(f"=>Exception {e.text}")
|
||||
print(f"=>JIRA Exception {e.text}")
|
||||
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=f"JIRA: {e.text}")
|
||||
projects_dict_list = []
|
||||
for project in projects:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue