diff options
author | Simon Rettberg | 2024-10-11 14:16:35 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-10-11 14:16:35 +0200 |
commit | 6fc0df0f65b3caf57886ee4dbf5cfc8e51254933 (patch) | |
tree | a39ef77a05df614ca0be434fc6f25e2cbe14dddf | |
parent | [webinterface] Add event log messages for cert changes (diff) | |
download | slx-admin-6fc0df0f65b3caf57886ee4dbf5cfc8e51254933.tar.gz slx-admin-6fc0df0f65b3caf57886ee4dbf5cfc8e51254933.tar.xz slx-admin-6fc0df0f65b3caf57886ee4dbf5cfc8e51254933.zip |
[sysconfig] Try harder to log meaningful error if module generation fails
-rw-r--r-- | modules-available/sysconfig/inc/configmodule.inc.php | 15 |
1 files 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) { |