Remove exception-handlers which catch exceptions that are never raised

This commit is contained in:
Matthias 2021-12-11 16:20:09 +01:00
parent 8da79d0ab2
commit 857f4ec125

View File

@ -1163,14 +1163,9 @@ class Telegram(RPCHandler):
Handler for /blacklist
Shows the currently active blacklist
"""
try:
self.send_blacklist_msg(self._rpc._rpc_blacklist(context.args))
except RPCException as e:
self._send_msg(str(e))
def send_blacklist_msg(self, blacklist: Dict):
try:
errmsgs = []
for pair, error in blacklist['errors'].items():
errmsgs.append(f"Error adding `{pair}` to blacklist: `{error['error_msg']}`")
@ -1182,8 +1177,6 @@ class Telegram(RPCHandler):
logger.debug(message)
self._send_msg(message)
except RPCException as e:
self._send_msg(str(e))
@authorized_only
def _blacklist_delete(self, update: Update, context: CallbackContext) -> None:
@ -1191,10 +1184,7 @@ class Telegram(RPCHandler):
Handler for /bl_delete
Deletes pair(s) from current blacklist
"""
try:
self.send_blacklist_msg(self._rpc._rpc_blacklist_delete(context.args))
except RPCException as e:
self._send_msg(str(e))
@authorized_only
def _logs(self, update: Update, context: CallbackContext) -> None: