From 0cbf16461e05bc5f15d3436763667b1d34869826 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 18 Mar 2024 09:36:55 +0100 Subject: ogclient: consolidate logging in client core The main function must be able to handle the login of critical error in the main ogClient class instance. Add a try except block to the ogCLient run logic and move the relevant error logs into the except block. Delegate the error messages to the exception message. This is the first step towards error message deduplication. --- ogclient | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ogclient') diff --git a/ogclient b/ogclient index 8798ed6..a83b9ed 100755 --- a/ogclient +++ b/ogclient @@ -88,9 +88,12 @@ def main(): if args.debug: logging.getLogger().setLevel('DEBUG') - client = ogClient(config=CONFIG) - client.connect() - client.run() + try: + client = ogClient(config=CONFIG) + client.connect() + client.run() + except Exception as e: + logging.critical(e) if __name__ == "__main__": main() -- cgit v1.2.3-18-g5258