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

Added Exception Message to Taks Notification Email #43666

Open
wants to merge 12 commits into
base: 5.1-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="Execution 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}"
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}"
PLG_SYSTEM_TASK_NOTIFICATION_FAILURE_MAIL_SUBJECT="Task Failure"
PLG_SYSTEM_TASK_NOTIFICATION_FATAL_MAIL_BODY="Joomla! 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}"
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}"
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,7 +241,13 @@ 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() ?? '',
// this might rersult 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
'TASK_EXCEPTION' => ($task->getContent()['exception']?->getMessage() ?? '')
."\n\n".
Path::removeRoot($task->getContent()['exception']?->getTraceAsString() ?? '')
,

];
}

Expand Down