Skip to content

Commit

Permalink
fix: Print error during commands and catch more general errors during…
Browse files Browse the repository at this point in the history
… migration

Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Jan 24, 2024
1 parent 4a94719 commit 25d220e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Command/TransferLegacyRows.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private function transferDataForTables(array $tables, OutputInterface $output):
if ($output->isVerbose()) {
$output->writeln("❌ Error: " . $e->getMessage());
}
$output->writeln("⚠️ Could not transfer data. Continue with next table. The logs will have more information about the error.");
$output->writeln("⚠️ Could not transfer data. Continue with next table. The logs will have more information about the error: " . $e->getMessage());
}
$i++;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Migration/NewDbStructureRepairStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
use Psr\Log\LoggerInterface;
use Throwable;

class NewDbStructureRepairStep implements IRepairStep {

Expand Down Expand Up @@ -72,7 +73,7 @@ private function transferDataForTables(array $tables, IOutput $output) {
$output->info("-- Start transfer for table " . $table->getId() . " (" . $table->getTitle() . ") [" . $i . "/" . count($tables) . "]");
try {
$this->transferTable($table, $output);
} catch (InternalError|PermissionError|Exception $e) {
} catch (InternalError|PermissionError|Exception|Throwable $e) {
$this->logger->error($e->getMessage(), ['exception' => $e]);
$output->warning("Could not transfer data. Continue with next table. The logs will have more information about the error: " . $e->getMessage());
}
Expand Down

0 comments on commit 25d220e

Please sign in to comment.