Add error handling for missing custom label settings in utils.py

This commit is contained in:
mrT23
2024-08-13 16:40:05 +03:00
parent e7e3970874
commit f89bdcf3c3

View File

@ -674,14 +674,16 @@ def get_user_labels(current_labels: List[str] = None):
Only keep labels that has been added by the user
"""
try:
enable_custom_labels = get_settings().config.get('enable_custom_labels', False)
custom_labels = get_settings().get('custom_labels', [])
if current_labels is None:
current_labels = []
user_labels = []
for label in current_labels:
if label.lower() in ['bug fix', 'tests', 'enhancement', 'documentation', 'other']:
continue
if get_settings().config.enable_custom_labels:
if label in get_settings().custom_labels:
if enable_custom_labels:
if label in custom_labels:
continue
user_labels.append(label)
if user_labels: