ruff: Fix TRY401 Redundant exception object included in logging.exception
call.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
6b2861c3ec
commit
235f92afb0
6 changed files with 11 additions and 11 deletions
|
@ -70,8 +70,8 @@ at syntax by: @mention-botname help"
|
||||||
return (
|
return (
|
||||||
f"[Datapoint]({datapoint_link}) created."
|
f"[Datapoint]({datapoint_link}) created."
|
||||||
) # Handles the case of successful datapoint creation
|
) # Handles the case of successful datapoint creation
|
||||||
except ConnectionError as e:
|
except ConnectionError:
|
||||||
logging.exception(str(e))
|
logging.exception("Error connecting to Beeminder")
|
||||||
return "Uh-Oh, couldn't process the request \
|
return "Uh-Oh, couldn't process the request \
|
||||||
right now.\nPlease try again later"
|
right now.\nPlease try again later"
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ class BeeminderHandler:
|
||||||
)
|
)
|
||||||
if r.status_code == 401:
|
if r.status_code == 401:
|
||||||
bot_handler.quit("Invalid key!")
|
bot_handler.quit("Invalid key!")
|
||||||
except ConnectionError as e:
|
except ConnectionError:
|
||||||
logging.exception(str(e))
|
logging.exception("Error connecting to Beeminder")
|
||||||
|
|
||||||
def usage(self) -> str:
|
def usage(self) -> str:
|
||||||
return "This plugin allows users to add datapoints towards their Beeminder goals"
|
return "This plugin allows users to add datapoints towards their Beeminder goals"
|
||||||
|
|
|
@ -35,7 +35,7 @@ def get_bot_result(message_content: str, config: Dict[str, str], sender_id: str)
|
||||||
return "Error. No result."
|
return "Error. No result."
|
||||||
return res_json["result"]["fulfillment"]["speech"]
|
return res_json["result"]["fulfillment"]["speech"]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception(str(e))
|
logging.exception("Error getting Dialogflow bot response")
|
||||||
return f"Error. {e}."
|
return f"Error. {e}."
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ def make_flock_request(url: str, params: Dict[str, str]) -> Tuple[Any, str]:
|
||||||
try:
|
try:
|
||||||
res = requests.get(url, params=params)
|
res = requests.get(url, params=params)
|
||||||
return (res.json(), None)
|
return (res.json(), None)
|
||||||
except ConnectionError as e:
|
except ConnectionError:
|
||||||
logging.exception(str(e))
|
logging.exception("Error connecting to Flock")
|
||||||
error = "Uh-Oh, couldn't process the request \
|
error = "Uh-Oh, couldn't process the request \
|
||||||
right now.\nPlease try again later"
|
right now.\nPlease try again later"
|
||||||
return (None, error)
|
return (None, error)
|
||||||
|
|
|
@ -57,8 +57,8 @@ class GithubHandler:
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
self.GITHUB_ISSUE_URL_TEMPLATE.format(owner=owner, repo=repo, id=number)
|
self.GITHUB_ISSUE_URL_TEMPLATE.format(owner=owner, repo=repo, id=number)
|
||||||
)
|
)
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException:
|
||||||
logging.exception(str(e))
|
logging.exception("Error connecting to GitHub")
|
||||||
return None
|
return None
|
||||||
if r.status_code != requests.codes.ok:
|
if r.status_code != requests.codes.ok:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -62,7 +62,7 @@ def get_google_result(search_keywords: str) -> str:
|
||||||
return "Found no results."
|
return "Found no results."
|
||||||
return "Found Result: [{}]({})".format(results[0]["name"], results[0]["url"])
|
return "Found Result: [{}]({})".format(results[0]["name"], results[0]["url"])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception(str(e))
|
logging.exception("Error fetching Google results")
|
||||||
return f"Error: Search failed. {e}."
|
return f"Error: Search failed. {e}."
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ class GameAdapter:
|
||||||
else:
|
else:
|
||||||
self.send_reply(message, self.help_message())
|
self.send_reply(message, self.help_message())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception(str(e))
|
logging.exception("Error handling game message")
|
||||||
self.bot_handler.send_reply(message, f"Error {e}.")
|
self.bot_handler.send_reply(message, f"Error {e}.")
|
||||||
|
|
||||||
def is_user_in_game(self, user_email: str) -> str:
|
def is_user_in_game(self, user_email: str) -> str:
|
||||||
|
|
Loading…
Add table
Reference in a new issue