summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-05-16 15:18:48 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-05-16 15:18:48 +0300
commit302b3a78bd7a61be877daa66f81d406189b7ef62 (patch)
tree1d2bcd212ec862f277781114826e67cec01fa4df
parentef00f7d6695f924fa6f50ab954da12a263d840fb (diff)
don't send telegram.error.TimedOut to user
-rwxr-xr-xinverter-bot16
1 files changed, 11 insertions, 5 deletions
diff --git a/inverter-bot b/inverter-bot
index 921b185..b9937e4 100755
--- a/inverter-bot
+++ b/inverter-bot
@@ -21,6 +21,7 @@ from telegram.ext import (
MessageHandler,
CallbackContext
)
+from telegram.error import TimedOut
class InverterClientWrapper:
@@ -121,7 +122,8 @@ def msg_status(update: Update, context: CallbackContext) -> None:
reply(update, html)
except Exception as e:
logging.exception(str(e))
- reply(update, 'exception: ' + str(e))
+ if not isinstance(e, TimedOut):
+ reply(update, 'exception: ' + str(e))
def msg_generation(update: Update, context: CallbackContext) -> None:
@@ -161,7 +163,8 @@ def msg_generation(update: Update, context: CallbackContext) -> None:
reply(update, html)
except Exception as e:
logging.exception(str(e))
- reply(update, 'exception: ' + str(e))
+ if not isinstance(e, TimedOut):
+ reply(update, 'exception: ' + str(e))
def msg_gs(update: Update, context: CallbackContext) -> None:
@@ -170,7 +173,8 @@ def msg_gs(update: Update, context: CallbackContext) -> None:
reply(update, status)
except Exception as e:
logging.exception(str(e))
- reply(update, 'exception: ' + str(e))
+ if not isinstance(e, TimedOut):
+ reply(update, 'exception: ' + str(e))
def msg_ri(update: Update, context: CallbackContext) -> None:
@@ -179,7 +183,8 @@ def msg_ri(update: Update, context: CallbackContext) -> None:
reply(update, rated)
except Exception as e:
logging.exception(str(e))
- reply(update, 'exception: ' + str(e))
+ if not isinstance(e, TimedOut):
+ reply(update, 'exception: ' + str(e))
def msg_errors(update: Update, context: CallbackContext) -> None:
@@ -188,7 +193,8 @@ def msg_errors(update: Update, context: CallbackContext) -> None:
reply(update, errors)
except Exception as e:
logging.exception(str(e))
- reply(update, 'exception: ' + str(e))
+ if not isinstance(e, TimedOut):
+ reply(update, 'exception: ' + str(e))
def msg_all(update: Update, context: CallbackContext) -> None: