Improve error messages

This commit is contained in:
Bridget
2020-04-14 00:29:32 +02:00
parent 8fc72102ff
commit 8e9b9fafe3

4
lib.py
View File

@@ -54,7 +54,7 @@ def connect(url: str, secret_key: str) -> str:
Returns the UUID of the endpoint."""
uuid = send_cmd(url, secret_key, "connect").get("uuid", None)
if not uuid:
raise InvalidResponseError("Error: Endpoint did not return its UUID")
raise InvalidResponseError("Endpoint did not return its UUID")
return uuid
@@ -77,6 +77,6 @@ def get_available_commands(url: str, secret_key: str) -> Dict:
"""Get a list of available commands from the endpoint."""
cmds = send_cmd(url, secret_key, "get_commands").get("available_commands", None)
if not cmds:
raise InvalidResponseError("Error: Endpoint did not return command list")
raise InvalidResponseError("Endpoint did not return command list")
return cmds