diff --git a/bauh/gems/arch/worker.py b/bauh/gems/arch/worker.py index b1b57593..50910c9c 100644 --- a/bauh/gems/arch/worker.py +++ b/bauh/gems/arch/worker.py @@ -2,6 +2,7 @@ import logging import os import re import time +import traceback from math import ceil from multiprocessing import Process from threading import Thread @@ -152,13 +153,18 @@ class CategoriesDownloader: res = self.http_client.get(self.URL_CATEGORIES_FILE) if res: - categories_map = {} - for l in res.text.split('\n'): - if l: - data = l.split('=') - categories_map[data[0]] = [c.strip() for c in data[1].split(',') if c] + try: + categories_map = {} + for l in res.text.split('\n'): + if l: + data = l.split('=') + categories_map[data[0]] = [c.strip() for c in data[1].split(',') if c] - self.logger.info('Loaded categories for {} AUR packages'.format(len(categories_map))) - return categories_map + self.logger.info('Loaded categories for {} AUR packages'.format(len(categories_map))) + return categories_map + except: + self.logger.error("Could not parse AUR categories definitions") + traceback.print_exc() + return {} else: self.logger.info('Could not download {}'.format(self.URL_CATEGORIES_FILE)) diff --git a/bauh/gems/snap/worker.py b/bauh/gems/snap/worker.py index 22539c93..6bfd9c08 100644 --- a/bauh/gems/snap/worker.py +++ b/bauh/gems/snap/worker.py @@ -88,13 +88,18 @@ class CategoriesDownloader: res = self.http_client.get(self.URL_CATEGORIES_FILE) if res: - categories_map = {} - for l in res.text.split('\n'): - if l: - data = l.split('=') - categories_map[data[0]] = [c.strip() for c in data[1].split(',') if c] + try: + categories_map = {} + for l in res.text.split('\n'): + if l: + data = l.split('=') + categories_map[data[0]] = [c.strip() for c in data[1].split(',') if c] - self.logger.info('Loaded categories for {} Snap applications'.format(len(categories_map))) - return categories_map + self.logger.info('Loaded categories for {} Snap applications'.format(len(categories_map))) + return categories_map + except: + self.logger.error("Could not parse categories definitions") + traceback.print_exc() + return {} else: self.logger.info('Could not download {}'.format(self.URL_CATEGORIES_FILE))