Skip to content

Commit

Permalink
Added verbose error reporting in case of a failure
Browse files Browse the repository at this point in the history
  • Loading branch information
alongosz committed Feb 1, 2022
1 parent 9dd59b9 commit ab1a917
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/bundle/Command/IbexaRebrandingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,21 @@ private function process(RebrandingInterface $rebranding, string $sourcePath, bo
$progressBar->display();

foreach ($files as $file) {
if (strpos($file->getPathname(), 'vendor/ibexa/compatibility-layer/') === 0) {
$pathname = $file->getPathname();
if (strpos($pathname, 'vendor/ibexa/compatibility-layer/') === 0) {
$progressBar->advance();
continue;
}
$input = file_get_contents($file->getPathname());
$output = $rebranding->rebrand($input);
try {
$output = $rebranding->rebrand($input);
} catch (\Exception $e) {
$msg = sprintf('In file "%s": %s - %s', $pathname, get_class($e), $e->getMessage());
if ($this->style->isVerbose()) {
$msg .= "\nStack Trace:\n" . $e->getTraceAsString();
}
$this->style->error($msg);
}

if (!$dryRun) {
file_put_contents($file->getPathname(), $output);
Expand Down

0 comments on commit ab1a917

Please sign in to comment.