From 263002bc45f201fc5a1c38d75031a85ace152772 Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Mon, 12 Jun 2023 10:42:20 -0400 Subject: [PATCH] cleaned up try..except --- main.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 883cd9b..8c7ff5e 100644 --- a/main.py +++ b/main.py @@ -51,16 +51,15 @@ async def main() -> None: try: with open('texlily.yaml', 'r') as conf: config = yaml.safe_load(conf) - # if config file does not exist, quit - except FileNotFoundError: - print("No config file found.\nPlease create a file named `texlily.yaml` and read the README file.") - quit() - try: # Retrieve our configuration homeserver = str(config["homeserver"]) user = str(config["user"]) token = str(config["token"]) # path = str(config["path"]) # not used + # if config file does not exist, quit + except FileNotFoundError: + print("No config file found.\nPlease create a file named `texlily.yaml` and read the README file.") + quit() except TypeError: print("Invalid configuration file.") quit()