mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Improve exception handle when running actions
- Don't use depricated exception.message. Instead using exception.args - Pass stdout output along with stderr in exception - Handle possible exceptions such as ValueError, OSError in all cases - Log all command executions and their errors
This commit is contained in:
1 parent
b77c97e088
commit
642a4e10ff
6 files changed
+30
-29
No files matched your search
@@ -6,7 +6,6 @@ from gettext import gettext as _
|
||||
|
||||
import actions
|
||||
import cfg
|
||||
from errors import ActionError
|
||||
|
||||
|
||||
def get_modules_available():
|
||||
@@ -86,7 +85,7 @@ def _apply_changes(request, old_status, new_status):
|
||||
try:
|
||||
actions.superuser_run(
|
||||
'module-manager', ['enable', cfg.python_root, module])
|
||||
except ActionError:
|
||||
except Exception:
|
||||
# TODO: need to get plinth to load the module we just
|
||||
# enabled
|
||||
messages.error(
|
||||
@@ -100,7 +99,7 @@ def _apply_changes(request, old_status, new_status):
|
||||
try:
|
||||
actions.superuser_run(
|
||||
'module-manager', ['disable', cfg.python_root, module])
|
||||
except ActionError:
|
||||
except Exception:
|
||||
# TODO: need a smoother way for plinth to unload the
|
||||
# module
|
||||
messages.error(
|
||||
|
||||
Reference in new issue
Block a user