Skip to content

Commit

Permalink
migrate: Simplify error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Nov 10, 2023
1 parent d344da1 commit dacb3db
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions application/clicommands/MigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public function roleAction(): void
try {
$rolesConfig->saveIni();
} catch (NotWritableError $error) {
Logger::error('%s: %s', $error->getMessage(), $error->getPrevious()->getMessage());
Logger::error($error);
if ($this->skipMigration) {
Logger::error('Failed to transform icingadb restrictions');
} else {
Expand Down Expand Up @@ -508,7 +508,7 @@ public function dashboardAction(): void
try {
$dashboardsConfig->saveIni();
} catch (NotWritableError $error) {
Logger::error('%s: %s', $error->getMessage(), $error->getPrevious()->getMessage());
Logger::error($error);
$rc = 256;
}
}
Expand Down Expand Up @@ -616,7 +616,7 @@ private function transformNavigationItems(Config $config, string $owner, &$rc):
try {
$config->saveIni();
} catch (NotWritableError $error) {
Logger::error('%s: %s', $error->getMessage(), $error->getPrevious()->getMessage());
Logger::error($error);
$rc = 256;

return false;
Expand Down Expand Up @@ -714,7 +714,7 @@ private function migrateNavigationItems(Config $config, string $owner, string $p
unlink($config->getConfigFile());
}
} catch (NotWritableError $error) {
Logger::error('%s: %s', $error->getMessage(), $error->getPrevious()->getMessage());
Logger::error($error);
$rc = 256;

return false;
Expand All @@ -737,11 +737,7 @@ private function readFromIni($path, &$rc)
try {
$config = Config::fromIni($path);
} catch (NotReadableError $error) {
if ($error->getPrevious() !== null) {
Logger::error('%s: %s', $error->getMessage(), $error->getPrevious()->getMessage());
} else {
Logger::error($error->getMessage());
}
Logger::error($error);

$config = new Config();
$rc = 128;
Expand Down

0 comments on commit dacb3db

Please sign in to comment.