Display install_app exceptions raised during action queuing

This commit is contained in:
Disassembler 2020-04-04 13:38:57 +02:00
parent 571e641787
commit 5265b31504
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499

View File

@ -199,46 +199,45 @@ class WSGIApp:
if app in pending_actions:
# Display queued or currently processed actions
app_queue = pending_actions[app]
if app_queue.index:
if app_queue.exception:
# Display failed task
if isinstance(app_queue.exception, InvalidSignature):
status = lang.repo_package_invalid_signature()
elif isinstance(app_queue.exception, NotFound):
status = lang.repo_package_missing()
elif isinstance(app_queue.exception, BaseException):
if app_queue.action in (vmmgr.start_app, vmmgr.stop_app):
status = lang.stop_start_error()
else:
status = lang.package_manager_error()
status = f'<span class="error">{status}<span> <a href="#" class="app-clear-status">OK</a>'
actions = None
else:
# Display task/subtask progress
action_item = app_queue.queue[app_queue.index-1]
if action_item.type in (ActionItemType.IMAGE_DOWNLOAD, ActionItemType.APP_DOWNLOAD):
status = lang.status_downloading(action_item.key)
elif action_item.type in (ActionItemType.IMAGE_UNPACK, ActionItemType.APP_UNPACK):
status = lang.status_unpacking(action_item.key)
elif action_item.type == ActionItemType.IMAGE_DELETE:
status = lang.status_deleting(action_item.key)
elif action_item.type == ActionItemType.APP_START:
status = lang.status_starting()
elif action_item.type == ActionItemType.APP_STOP:
status = lang.status_stopping()
elif action_item.type == ActionItemType.APP_INSTALL:
status = lang.status_installing()
elif action_item.type == ActionItemType.APP_UPDATE:
status = lang.status_updating()
elif action_item.type == ActionItemType.APP_UNINSTALL:
status = lang.status_uninstalling()
if app_queue.action not in (vmmgr.start_app, vmmgr.stop_app):
# For tasks other than start/stop which have only a single subtask, display also index of the subtask in queue
status = f'[{app_queue.index}/{len(app_queue.queue)}] {status}'
if action_item.units_total:
# Show progress for tasks which have measurable progress
status = f'{status} ({floor(action_item.units_done/action_item.units_total*100)} %)'
actions = '<div class="loader"></div>'
if app_queue.exception:
# Display failed task
if isinstance(app_queue.exception, InvalidSignature):
status = lang.repo_package_invalid_signature()
elif isinstance(app_queue.exception, NotFound):
status = lang.repo_package_missing()
elif isinstance(app_queue.exception, BaseException):
if app_queue.action in (vmmgr.start_app, vmmgr.stop_app):
status = lang.stop_start_error()
else:
status = lang.package_manager_error()
status = f'<span class="error">{status}<span> <a href="#" class="app-clear-status">OK</a>'
actions = None
elif app_queue.index:
# Display task/subtask progress
action_item = app_queue.queue[app_queue.index-1]
if action_item.type in (ActionItemType.IMAGE_DOWNLOAD, ActionItemType.APP_DOWNLOAD):
status = lang.status_downloading(action_item.key)
elif action_item.type in (ActionItemType.IMAGE_UNPACK, ActionItemType.APP_UNPACK):
status = lang.status_unpacking(action_item.key)
elif action_item.type == ActionItemType.IMAGE_DELETE:
status = lang.status_deleting(action_item.key)
elif action_item.type == ActionItemType.APP_START:
status = lang.status_starting()
elif action_item.type == ActionItemType.APP_STOP:
status = lang.status_stopping()
elif action_item.type == ActionItemType.APP_INSTALL:
status = lang.status_installing()
elif action_item.type == ActionItemType.APP_UPDATE:
status = lang.status_updating()
elif action_item.type == ActionItemType.APP_UNINSTALL:
status = lang.status_uninstalling()
if app_queue.action not in (vmmgr.start_app, vmmgr.stop_app):
# For tasks other than start/stop which have only a single subtask, display also index of the subtask in queue
status = f'[{app_queue.index}/{len(app_queue.queue)}] {status}'
if action_item.units_total:
# Show progress for tasks which have measurable progress
status = f'{status} ({floor(action_item.units_done/action_item.units_total*100)} %)'
actions = '<div class="loader"></div>'
else:
# Display queued (pending, not started) task
if app_queue.action == vmmgr.start_app: