Skip to content

Commit

Permalink
Additional error checking to fix #282
Browse files Browse the repository at this point in the history
  • Loading branch information
bobokun committed May 6, 2023
1 parent 8684066 commit 3a8bdf5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 30 deletions.
43 changes: 22 additions & 21 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,28 @@ def __init__(self, default_dir, args):
self.data["notifiarr"] = self.data.pop("notifiarr")
if "webhooks" in self.data:
temp = self.data.pop("webhooks")
if "function" not in temp or ("function" in temp and temp["function"] is None):
temp["function"] = {}

def hooks(attr):
if attr in temp:
items = temp.pop(attr)
if items:
temp["function"][attr] = items
if attr not in temp["function"]:
temp["function"][attr] = {}
temp["function"][attr] = None

hooks("cross_seed")
hooks("recheck")
hooks("cat_update")
hooks("tag_update")
hooks("rem_unregistered")
hooks("rem_orphaned")
hooks("tag_nohardlinks")
hooks("cleanup_dirs")
self.data["webhooks"] = temp
if temp is not None:
if "function" not in temp or ("function" in temp and temp["function"] is None):
temp["function"] = {}

def hooks(attr):
if attr in temp:
items = temp.pop(attr)
if items:
temp["function"][attr] = items
if attr not in temp["function"]:
temp["function"][attr] = {}
temp["function"][attr] = None

hooks("cross_seed")
hooks("recheck")
hooks("cat_update")
hooks("tag_update")
hooks("rem_unregistered")
hooks("rem_orphaned")
hooks("tag_nohardlinks")
hooks("cleanup_dirs")
self.data["webhooks"] = temp
if "bhd" in self.data:
self.data["bhd"] = self.data.pop("bhd")
self.dry_run = self.commands["dry_run"]
Expand Down
14 changes: 5 additions & 9 deletions qbit_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,12 @@ def finished_run():
try:
cfg = Config(default_dir, args)
qbit_manager = cfg.qbt

except Exception as ex:
if "Qbittorrent Error" in ex.args[0]:
logger.print_line(ex, "CRITICAL")
logger.print_line("Exiting scheduled Run.", "CRITICAL")
finished_run()
return None
else:
logger.stacktrace()
logger.print_line(ex, "CRITICAL")
logger.stacktrace()
logger.print_line(ex, "CRITICAL")
logger.print_line("Exiting scheduled Run.", "CRITICAL")
finished_run()
return None

if qbit_manager:
# Set Category
Expand Down

0 comments on commit 3a8bdf5

Please sign in to comment.