From a4478eabdce58b285856247b5894f3fb67215ada Mon Sep 17 00:00:00 2001 From: David Kozinn Date: Thu, 25 Apr 2024 19:07:46 +0000 Subject: [PATCH] Catch Reddit server errors --- .gitignore | 2 +- src/nasajobsbot.py | 2 +- src/nasamodqbot.py | 2 +- src/nasapostbot.py | 2 +- src/nasaxpost.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 47d455e..9a3368b 100644 --- a/.gitignore +++ b/.gitignore @@ -200,7 +200,7 @@ pyrightconfig.json #misc local.notes -**/test*.py +#**/test*.py **/approve*.py .ignore .vscode diff --git a/src/nasajobsbot.py b/src/nasajobsbot.py index a4429b9..af0e696 100644 --- a/src/nasajobsbot.py +++ b/src/nasajobsbot.py @@ -56,7 +56,7 @@ def main(): main() except KeyboardInterrupt: sys.exit(0) - except prawcore.exceptions.ServerError: + except (prawcore.exceptions.ServerError, prawcore.exceptions.ResponseException): logging.exception("Reddit error") sys.exit(2) except praw.exceptions.RedditAPIException: diff --git a/src/nasamodqbot.py b/src/nasamodqbot.py index dd57d75..e72fea4 100644 --- a/src/nasamodqbot.py +++ b/src/nasamodqbot.py @@ -85,7 +85,7 @@ def main(): main() except KeyboardInterrupt: sys.exit(0) - except prawcore.exceptions.ServerError: + except (prawcore.exceptions.ServerError, prawcore.exceptions.ResponseException): logging.exception("Reddit error") sys.exit(2) except Exception as error: # pylint: disable=broad-except diff --git a/src/nasapostbot.py b/src/nasapostbot.py index 54356a2..d62f4dd 100644 --- a/src/nasapostbot.py +++ b/src/nasapostbot.py @@ -57,7 +57,7 @@ def main(): main() except KeyboardInterrupt: sys.exit(0) - except prawcore.exceptions.ServerError: + except (prawcore.exceptions.ServerError, prawcore.exceptions.ResponseException): logging.exception("Reddit error") sys.exit(2) except Exception as error: # pylint: disable=broad-except diff --git a/src/nasaxpost.py b/src/nasaxpost.py index aa9d0be..2e0e57e 100644 --- a/src/nasaxpost.py +++ b/src/nasaxpost.py @@ -89,7 +89,7 @@ def main(): main() except KeyboardInterrupt: sys.exit(0) - except prawcore.exceptions.ServerError: + except (prawcore.exceptions.ServerError, prawcore.exceptions.ResponseException): logging.exception("Reddit error") sys.exit(2) except Exception as error: # pylint: disable=broad-except