Skip to content

Commit ce08f23

Browse files
author
admin
committed
added error handling
1 parent 833d793 commit ce08f23

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

app/util/analytics/application_info.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ def apps_count(self):
109109

110110
@cached_property
111111
def __get_apps(self):
112-
return self.client.get_installed_apps()
112+
try:
113+
return self.client.get_installed_apps()
114+
except Exception as e:
115+
print(f'ERROR: Could not get the installed applications. Error: {e}')
116+
return []
113117

114118
@cached_property
115119
def __get_custom_apps(self):

app/util/data_preparation/jira_prepare_data.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,17 @@ def __check_license(client):
178178

179179

180180
def __check_number_of_custom_app(client):
181-
all_apps = client.get_installed_apps()
182-
apps_with_vendor_defined = [app for app in all_apps if 'vendor' in app]
183-
non_atlassian_apps = [app for app in apps_with_vendor_defined if 'Atlassian' not in
184-
app['vendor']['name'] and app['userInstalled'] == True]
185-
non_atlassian_apps_names = [app['name'] for app in non_atlassian_apps]
186-
print(f"Custom application count: {len(non_atlassian_apps)}")
187-
print(f'Custom app names:')
188-
print(*non_atlassian_apps_names, sep='\n')
181+
try:
182+
all_apps = client.get_installed_apps()
183+
apps_with_vendor_defined = [app for app in all_apps if 'vendor' in app]
184+
non_atlassian_apps = [app for app in apps_with_vendor_defined if 'Atlassian' not in
185+
app['vendor']['name'] and app['userInstalled'] == True]
186+
non_atlassian_apps_names = [app['name'] for app in non_atlassian_apps]
187+
print(f"Custom application count: {len(non_atlassian_apps)}")
188+
print(f'Custom app names:')
189+
print(*non_atlassian_apps_names, sep='\n')
190+
except Exception as e:
191+
print(f'ERROR: Could not get the installed applications. Error: {e}')
189192

190193

191194

0 commit comments

Comments
 (0)