diff --git a/CB/__init__.py b/CB/__init__.py index b4ba0bb..16a1fb8 100644 --- a/CB/__init__.py +++ b/CB/__init__.py @@ -1,7 +1,7 @@ import string import random -__version__ = '2.7.0' +__version__ = '2.7.1' __license__ = 'GPLv3' __copyright__ = '2019, Paweł Jastrzębski ' __docformat__ = 'restructuredtext en' diff --git a/CurseBreaker.py b/CurseBreaker.py index 6460dde..0e5eb18 100644 --- a/CurseBreaker.py +++ b/CurseBreaker.py @@ -171,14 +171,21 @@ def auto_update(self): os.system('pause') sys.exit(1) - def handle_exception(self, e): - if len(self.tableData) > 1: + def handle_exception(self, e, table=True): + if len(self.tableData) > 1 and table: printft(ANSI(self.table.table)) if getattr(sys, 'frozen', False): - printft(HTML(f'\n{str(e)}')) + if isinstance(e, list): + for es in e: + printft(HTML(f'\n{str(es)}')) + else: + printft(HTML(f'\n{str(e)}')) else: - sys.tracebacklimit = 1000 - traceback.print_exc() + if isinstance(e, list): + for es in e: + traceback.print_exception(es, es, es.__traceback__, limit=1000) + else: + traceback.print_exc(limit=1000) def print_header(self): os.system('cls') @@ -284,25 +291,32 @@ def c_update(self, args, addline=False, update=True, force=False): addons = sorted(self.core.config['Addons'], key=lambda k: k['Name'].lower()) self.core.bulk_check(addons) with tqdm(total=len(addons), bar_format='{n_fmt}/{total_fmt} |{bar}|') as pbar: + exceptions = [] for addon in addons: - name, versionnew, versionold, modified = self.core.\ - update_addon(addon if isinstance(addon, str) else addon['URL'], update, force) - if versionold: - if versionold == versionnew: - if modified: - self.tableData.append([f'{AC.LIGHTRED_EX}Modified{AC.RESET}', name, versionold]) + try: + name, versionnew, versionold, modified = self.core.\ + update_addon(addon if isinstance(addon, str) else addon['URL'], update, force) + if versionold: + if versionold == versionnew: + if modified: + self.tableData.append([f'{AC.LIGHTRED_EX}Modified{AC.RESET}', name, versionold]) + else: + self.tableData.append([f'{AC.GREEN}Up-to-date{AC.RESET}', name, versionold]) else: - self.tableData.append([f'{AC.GREEN}Up-to-date{AC.RESET}', name, versionold]) + if modified: + self.tableData.append([f'{AC.LIGHTRED_EX}Update suppressed{AC.RESET}', + name, versionold]) + else: + self.tableData.append([f'{AC.YELLOW}{"Updated " if update else "Update available"}' + f'{AC.RESET}', name, f'{AC.YELLOW}{versionnew}{AC.RESET}']) else: - if modified: - self.tableData.append([f'{AC.LIGHTRED_EX}Update suppressed{AC.RESET}', name, versionold]) - else: - self.tableData.append([f'{AC.YELLOW}{"Updated " if update else "Update available"}' - f'{AC.RESET}', name, f'{AC.YELLOW}{versionnew}{AC.RESET}']) - else: - self.tableData.append([f'{AC.LIGHTBLACK_EX}Not installed{AC.RESET}', addon, '']) + self.tableData.append([f'{AC.LIGHTBLACK_EX}Not installed{AC.RESET}', addon, '']) + except Exception as e: + exceptions.append(e) pbar.update(1) printft(ANSI('\n' + self.table.table if addline else self.table.table)) + if len(exceptions) > 0: + self.handle_exception(exceptions, False) def c_force_update(self, args): if args: