mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
actions: Provide HTML error message with action error
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
37f14a82c7
commit
63fbd20692
@ -155,6 +155,19 @@ def _wait_for_return(module_name, action_name, args, kwargs, log_error, proc,
|
|||||||
exception.stdout = stdout
|
exception.stdout = stdout
|
||||||
exception.stderr = stderr
|
exception.stderr = stderr
|
||||||
|
|
||||||
|
def _get_html_message():
|
||||||
|
"""Return an HTML format error that can be shown in messages."""
|
||||||
|
from django.utils.html import format_html
|
||||||
|
|
||||||
|
full_args, exception_args, stdout, stderr, traceback = _format_error(
|
||||||
|
args, kwargs, exception, return_value)
|
||||||
|
return format_html('Error running action: {}..{}({}): {}({})\n{}{}{}',
|
||||||
|
module_name, action_name, full_args,
|
||||||
|
return_value['exception']['name'], exception_args,
|
||||||
|
stdout, stderr, traceback)
|
||||||
|
|
||||||
|
exception.get_html_message = _get_html_message
|
||||||
|
|
||||||
if log_error:
|
if log_error:
|
||||||
full_args, exception_args, stdout, stderr, traceback = _format_error(
|
full_args, exception_args, stdout, stderr, traceback = _format_error(
|
||||||
args, kwargs, exception, return_value)
|
args, kwargs, exception, return_value)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user