Mbonea commited on
Commit
4e4e828
·
1 Parent(s): 6f4f5f9

handle failed messages

Browse files
Files changed (1) hide show
  1. App/Android/Android.py +6 -3
App/Android/Android.py CHANGED
@@ -56,7 +56,7 @@ class AndroidClient:
56
  try:
57
  data = response.json()
58
  except:
59
- return False
60
  if "active_users" in data:
61
  active_users = data["active_users"]
62
 
@@ -122,8 +122,11 @@ class AndroidClient:
122
  "event": event,
123
  }
124
  response = await self.client.post("/send_message", json=data)
125
- print(response)
126
- return response
 
 
 
127
 
128
  async def close(self):
129
  """Close the client session."""
 
56
  try:
57
  data = response.json()
58
  except:
59
+ return None
60
  if "active_users" in data:
61
  active_users = data["active_users"]
62
 
 
122
  "event": event,
123
  }
124
  response = await self.client.post("/send_message", json=data)
125
+ x = response.content
126
+ if response.status_code < 200 or response.status_code >= 300:
127
+ return response
128
+ else:
129
+ raise Exception(f"Error sending message : {x}")
130
 
131
  async def close(self):
132
  """Close the client session."""