Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Added Exception Message to Taks Notification Email #43666

Open
wants to merge 14 commits into
base: 5.3-dev
Choose a base branch
from
4 changes: 2 additions & 2 deletions administrator/language/en-GB/plg_system_tasknotification.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
; Note : All ini files need to be saved as UTF-8

PLG_SYSTEM_TASK_NOTIFICATION="System - Task Notification"
PLG_SYSTEM_TASK_NOTIFICATION_FAILURE_MAIL_BODY="Hello,\n\n\nPlanned execution of Scheduled Task#{TASK_ID}, {TASK_TITLE}, has failed with exit code {EXIT_CODE} at {EXEC_DATE_TIME}.\n\nPlease visit the Joomla! backend for more information.\n\n{TASK_OUTPUT}"
PLG_SYSTEM_TASK_NOTIFICATION_FAILURE_MAIL_BODY="Hello,\n\nExecution of Scheduled Task#{TASK_ID}, {TASK_TITLE}, has failed with exit code {EXIT_CODE} at {EXEC_DATE_TIME}. The error message is shown below. The problem might be temporarily or related to this scheduled task only. However, it might impact your site as well. Please verify that your site is working correctly as soon as possible..\n{TASK_OUTPUT}\nError Message (if any):\n{TASK_EXCEPTION}"
brbrbr marked this conversation as resolved.
Show resolved Hide resolved
PLG_SYSTEM_TASK_NOTIFICATION_FAILURE_MAIL_SUBJECT="Task Failure"
PLG_SYSTEM_TASK_NOTIFICATION_FATAL_MAIL_BODY="Hello,\n\nPlanned execution of Scheduler Task#{TASK_ID}, {TASK_TITLE}, recovered from a fatal failure.\n\nThis could mean that the task execution exhausted the system resources or the restrictions from the PHP INI.\n\nPlease visit the Joomla! backend for more information."
PLG_SYSTEM_TASK_NOTIFICATION_FATAL_MAIL_BODY="Hello,\n\nJoomla! caught a fatal failure while executing the Scheduled Task#{TASK_ID}, {TASK_TITLE} at {EXEC_DATE_TIME}. The error message is shown below. This could mean that the task execution exhausted the system resources or the restrictions from the PHP INI. The problem might be temporarily or related to this scheduled task only. However, it might impact your site as well. Please verify that your site is working correctly as soon as possible..\n{TASK_OUTPUT}\nError Message (if any):\n{TASK_EXCEPTION}"
brbrbr marked this conversation as resolved.
Show resolved Hide resolved
PLG_SYSTEM_TASK_NOTIFICATION_FATAL_MAIL_SUBJECT="Task Recover from Fatal Failure"
PLG_SYSTEM_TASK_NOTIFICATION_LABEL_FAILURE_MAIL_TOGGLE="Task Failure"
PLG_SYSTEM_TASK_NOTIFICATION_LABEL_FATAL_FAILURE_MAIL_TOGGLE="Fatal Failures/Crashes (Recommended)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ private function getDataFromTask(Task $task): array
'EXIT_CODE' => $task->getContent()['status'] ?? Status::NO_EXIT,
'EXEC_DATE_TIME' => $lockOrExecTime,
'TASK_OUTPUT' => $task->getContent()['output_body'] ?? '',
'TASK_EXCEPTION' => ($task->getContent()['exception']?->getMessage() ?? '')
."\n\n". // This might result in one or two empty strings with new Lines. Not too visible in email or HTML, so not really worth the effort to add a lot of extra code to optimize this.
Path::removeRoot($task->getContent()['exception']?->getTraceAsString() ?? '')
,
brbrbr marked this conversation as resolved.
Show resolved Hide resolved
];
}

Expand Down