Skip to content

Commit

Permalink
Merge pull request #1137 from M0rgan01/Update-warnings-wording
Browse files Browse the repository at this point in the history
[LOG] Update some warnings wording
  • Loading branch information
M0rgan01 authored Jan 29, 2025
2 parents 967666f + 45d3574 commit 854c220
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion classes/Task/Update/UpdateModules.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function run(): int
$module = \Module::getInstanceByName($moduleInfos['name']);

if (!($module instanceof \Module)) {
throw (new UpgradeException($this->translator->trans('Error when trying to retrieve module %s instance.', [$moduleInfos['name']])))->setSeverity(UpgradeException::SEVERITY_WARNING);
throw (new UpgradeException($this->translator->trans('Retrieving the module instance of %s failed.', [$moduleInfos['name']])))->setSeverity(UpgradeException::SEVERITY_WARNING);
}

$moduleMigrationContext = new ModuleMigrationContext($module, $dbVersion);
Expand Down
4 changes: 2 additions & 2 deletions classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ protected function runSqlQuery(string $upgrade_file, string $query): void
$error = $this->db->getMsgError();
$error_number = $this->db->getNumberError();

$this->logger->warning('Error occurred during the execution of a query: ' . $error_number . ', ' . $error);
$this->logger->warning('Migration file: ' . $upgrade_file . ', Query: ' . $query);
$this->logger->warning($this->container->getTranslator()->trans('The execution of the query failed: %s, %s', [$error_number, $error]));
$this->logger->warning($this->container->getTranslator()->trans('Migration file: %s, Query: %s', [$upgrade_file, $query]));

$duplicates = ['1050', '1054', '1060', '1061', '1062', '1091'];
if (!in_array($error_number, $duplicates)) {
Expand Down
2 changes: 1 addition & 1 deletion classes/UpgradeTools/Module/ModuleMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function runMigration(ModuleMigrationContext $moduleMigrationContext): vo
throw $e;
} catch (Throwable $t) {
$moduleMigrationContext->getModuleInstance()->disable();
throw (new UpgradeException($this->translator->trans('Unexpected error when trying to upgrade module %s. Module %s disabled.', [$moduleMigrationContext->getModuleName(), $moduleMigrationContext->getModuleName()]), 0, $t))->setSeverity(UpgradeException::SEVERITY_WARNING);
throw (new UpgradeException($this->translator->trans('Unexpected issue when trying to upgrade module %s. Module %s disabled.', [$moduleMigrationContext->getModuleName(), $moduleMigrationContext->getModuleName()]), 0, $t))->setSeverity(UpgradeException::SEVERITY_WARNING);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/UpgradeTools/Module/ModuleMigrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function testRunMigrationWithUpgradeMethodThrowError()
$this->moduleMigration->needMigration($moduleMigrationContext);

$this->expectException(\PrestaShop\Module\AutoUpgrade\Exceptions\UpgradeException::class);
$this->expectExceptionMessage('Unexpected error when trying to upgrade module mymodule. Module mymodule disabled.');
$this->expectExceptionMessage('Unexpected issue when trying to upgrade module mymodule. Module mymodule disabled.');

$this->moduleMigration->runMigration($moduleMigrationContext);
}
Expand Down

0 comments on commit 854c220

Please sign in to comment.