Skip to content

Commit

Permalink
feat: optimize error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien committed Nov 10, 2024
1 parent ac6b970 commit 71c1424
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def argocd(app_name):
if response.status_code == 200:
return {"response": {"application": response.json()}}
else:
return {"response": "No results found."}
return {"response": {"error":response.json()}}

def kubectl(query):
resultat = subprocess.getstatusoutput("kubectl --kubeconfig ~/.kube/myteslamate-prod.yaml " + query)
Expand Down Expand Up @@ -146,7 +146,7 @@ def grafana(email):
if user:
return {"response": { "user": user}}
else:
return {"response": "No results found."}
return {"response": "No user found."}

def stripe(email):
"""Query by email to stripe to find if a customer exists."""
Expand All @@ -161,7 +161,7 @@ def stripe(email):

return {"response": { "email": customers.data[0].email, "created": customers.data[0].created, "subscriptions": subscriptions.data}}
else:
return {"response": "No results found."}
return {"response": "No user found."}

def stripe_cancel(subscription_id):
"""Cancel a subscription by subscription_id on Stripe."""
Expand Down

0 comments on commit 71c1424

Please sign in to comment.