From e06dc9a5e84feb9e0decb52932640ee2b95b9612 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 7 Feb 2017 22:35:19 +0100 Subject: [PATCH] wot --- telegram.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/telegram.py b/telegram.py index f6d41603..7ce45861 100644 --- a/telegram.py +++ b/telegram.py @@ -8,6 +8,9 @@ file = open("telegramtoken.txt", "r") token = file.read() file.close() +class TelegramError(Exception): + pass + # Send a message async def send_message(msg: str, to: int): print("[Telegram] Sending a message: " + msg) @@ -22,4 +25,4 @@ async def send_message(msg: str, to: int): if r.status_code == 200: return else: - raise Exception("Something went wrong in the Telegram request.") + raise TelegramError("Something went wrong in the Telegram request: {}".format(r.json()["description"]))