SignalAPI: improve error messages
This commit is contained in:
parent
6fa7cf5766
commit
acb8ae2847
6
main.py
6
main.py
@ -166,7 +166,7 @@ class SignalAPI:
|
||||
if r.status_code == 204:
|
||||
return Ok(None)
|
||||
else:
|
||||
return Err(r.json().error)
|
||||
return Err(r.json()['error'])
|
||||
|
||||
def remove_group_admins(self, group_id: str, admins: List[str]) -> Result[None, str]:
|
||||
r = requests.delete(f"{self.apiurl}/v1/groups/{self.number}/{group_id}/admins", json={"admins": admins})
|
||||
@ -174,7 +174,7 @@ class SignalAPI:
|
||||
if r.status_code == 204:
|
||||
return Ok(None)
|
||||
else:
|
||||
return Err(r.json().error)
|
||||
return Err(r.json()['error'])
|
||||
|
||||
def update_group_admins(self, group_id: str, other_admins: List[str], remove: bool = True) -> Result[Changes[str], str]:
|
||||
# Add and remove admins from the group, such that the only remaining
|
||||
@ -233,7 +233,7 @@ class SignalAPI:
|
||||
if r.status_code == 201:
|
||||
return parse_response(SendMessageResponse, r.text)
|
||||
else:
|
||||
return Err("Failed to send message")
|
||||
return Err(r.json()['error'])
|
||||
|
||||
|
||||
class LabCleaningBot:
|
||||
|
Loading…
Reference in New Issue
Block a user