From 3795ed3daf1f4577169991173f4a105bc6368a00 Mon Sep 17 00:00:00 2001 From: Kozaka Date: Mon, 19 Sep 2022 03:08:20 +0200 Subject: [PATCH] #119 better error handling + better log + debug turned off for exe file --- build.spec | 2 +- modules/cdlc_importer/load_cdlc_json_file.py | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/build.spec b/build.spec index fd46563..3ef8417 100644 --- a/build.spec +++ b/build.spec @@ -26,7 +26,7 @@ exe = EXE(pyz, a.datas, [], name='RocksmithServant', - debug=True, + debug=False, bootloader_ignore_signals=False, strip=False, upx=True, diff --git a/modules/cdlc_importer/load_cdlc_json_file.py b/modules/cdlc_importer/load_cdlc_json_file.py index 48ea797..35cebc8 100644 --- a/modules/cdlc_importer/load_cdlc_json_file.py +++ b/modules/cdlc_importer/load_cdlc_json_file.py @@ -24,8 +24,19 @@ def __init__(self, config_data, db): def load(self): logger.log("-----------------------------------", MODULE_NAME) logger.warning("Importing CDLC files from CFSM json file...", MODULE_NAME) - self.init_db() - self.import_cdlc_files() + + try: + self.init_db() + except Exception as e: + logger.error("Database init error: {0}".format(e)) + raise e + + try: + self.import_cdlc_files() + except Exception as e: + logger.error("Could not import CDLCs to the Database: {0}".format(e)) + raise e + logger.log("-----------------------------------", MODULE_NAME) def create_tables(self): @@ -37,7 +48,7 @@ def init_db(self): cursor = self.db.cursor() cursor.execute("SELECT count(name) FROM sqlite_master WHERE type='table' AND name='songs'") if cursor.fetchone()[0] == 1: - logger.debug("Songs Table exists.", MODULE_NAME) + logger.debug("Songs Table already exists, do not need to create it.", MODULE_NAME) else: logger.warning("Songs Table does not exists! Creating...", MODULE_NAME) self.create_tables()