Skip to content

Commit

Permalink
catch UnexpectedValueException
Browse files Browse the repository at this point in the history
  • Loading branch information
rcstr committed May 9, 2024
1 parent 047a255 commit 4deb9dc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/src/Commands/WooValidateZipCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ protected function execute( InputInterface $input, OutputInterface $output ): in
$this->zip_validator->validate_zip( $zip_file );

$output->writeln( '<info>Zip file content is valid.</info>' );
} catch ( \UnexpectedValueException $e ) {
$output->writeln( sprintf( '<comment>%s</comment>', $e->getMessage() ) );

return Command::FAILURE;
} catch ( \Exception $e ) {
$output->writeln( sprintf( '<error>An error occurred while validating the ZIP file. Error: %s</error>',
$e->getMessage() ) );
$output->writeln( sprintf( '<error>An error occurred while validating the ZIP file. Error: %s</error>', $e->getMessage() ) );

return Command::FAILURE;
}
Expand Down

0 comments on commit 4deb9dc

Please sign in to comment.