cleaned up try..except

This commit is contained in:
array-in-a-matrix 2023-06-12 10:42:20 -04:00
parent f8934853c6
commit 263002bc45

View file

@ -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()