From 6fc0df0f65b3caf57886ee4dbf5cfc8e51254933 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 11 Oct 2024 14:16:35 +0200 Subject: [sysconfig] Try harder to log meaningful error if module generation fails --- modules-available/sysconfig/inc/configmodule.inc.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules-available/sysconfig/inc/configmodule.inc.php b/modules-available/sysconfig/inc/configmodule.inc.php index 729cb959..34970d0a 100644 --- a/modules-available/sysconfig/inc/configmodule.inc.php +++ b/modules-available/sysconfig/inc/configmodule.inc.php @@ -549,12 +549,15 @@ abstract class ConfigModule EventLog::warning('generateFailed callback for module id ' . $args['moduleid'] . ', but no instance could be generated.'); return; } - if (isset($task['data']['error'])) { - $error = $task['data']['error']; - } elseif (isset($task['data']['messages'])) { - $error = $task['data']['messages']; - } else { - $error = ''; + $error = ''; + if (!empty($task['data']['error'])) { + $error .= $task['data']['error'] . "\n\n"; + } + if (!empty($task['data']['messages'])) { + $error .= $task['data']['messages'] . "\n\n"; + } + if (empty($error)) { + $error = json_encode($task, JSON_PRETTY_PRINT); } EventLog::failure("Generating module '" . $module->moduleTitle . "' failed.", $error); if ($args['deleteOnError'] ?? false) { -- cgit v1.2.3-55-g7522