Skip to content

Commit

Permalink
#119 better error handling
Browse files Browse the repository at this point in the history
+ better log
+ debug turned off for exe file
  • Loading branch information
kozaka-tv committed Sep 19, 2022
1 parent f2f0d0e commit 3795ed3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.spec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exe = EXE(pyz,
a.datas,
[],
name='RocksmithServant',
debug=True,
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
Expand Down
17 changes: 14 additions & 3 deletions modules/cdlc_importer/load_cdlc_json_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()
Expand Down

0 comments on commit 3795ed3

Please sign in to comment.