From 2a13faacecd250847e704a4dd65c991beb27daee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alve=20Svar=C3=A9n?= Date: Fri, 9 Oct 2020 19:27:27 +0200 Subject: [PATCH] Added more error handling when using as main file --- main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 0e535c4..3817e62 100755 --- a/main.py +++ b/main.py @@ -85,5 +85,9 @@ if __name__ == "__main__": if (len(argv) < 2): print('Usage: python main.py "Server name" 127.0.0.1') exit(1) - print(f"Creating file using arguments {argv[1:]}") - write_file(*argv[1:], log_bytes=True) + print(f"Creating file using arguments '{', '.join(argv[1:])}'") + try: + write_file(*argv[1:], log_bytes=True) + except Exception as error: + print("Error:", error) + exit(2) \ No newline at end of file