Skip to content

Commit

Permalink
fix the client
Browse files Browse the repository at this point in the history
  • Loading branch information
sumansaurabh committed Dec 28, 2023
1 parent 404d25f commit c14a771
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
import requests
import asyncio
import json
import traceback

async def notify_error(message):
message = f"GithubClient alert:\n {message}"
print(message)
other_vars = {
"GITHUB_REPOSITORY": os.getenv("GITHUB_REPOSITORY"),
"BRANCH_NAME": os.getenv("BRANCH_NAME"),
"SNORKELL_CLIENT_ID": os.getenv("SNORKELL_CLIENT_ID"),
}
headers = {"Content-type": "application/json"}
data = {
Expand Down Expand Up @@ -122,10 +124,24 @@ async def main():
if not is_valid_request:
return
await check_documentation_generation_status(headers, data)
except requests.exceptions.Timeout:
except requests.exceptions.Timeout as t:
print("Request timed out")
await notify_error("Request TIME_OUT "+traceback.format_exc())
raise t
except Exception as e:
print(f"An error occurred: {e}")
traceback.print_exc()
if "Could not validate credentials" in traceback.format_exc():
print("Invalid credentials")
print("To fix it")
print("Copy the API key from the Snorkell dashboard - https://dashboard.snorkell.ai/snorkell-api-keys")
print("Then go to your repository Settings -> Secrets & Variables -> Actions -> New repository secret")
print("Create a new secret with the name SNORKELL_API_KEY")
print("Paste the API key in the value field")
print("Rerun the action")

await notify_error(f"An error occurred: "+traceback.format_exc())
raise e


if __name__ == "__main__":
Expand Down

0 comments on commit c14a771

Please sign in to comment.