Merge pull request #40 from tgabi333/master

minor exception message cleanup
This commit is contained in:
Romain Neutron 2013-06-04 09:39:38 -07:00
commit 1c504e9b4d
2 changed files with 6 additions and 7 deletions

View file

@ -74,7 +74,7 @@ abstract class Binary implements AdapterInterface
public function setTimeout($timeout) public function setTimeout($timeout)
{ {
if (0 > $timeout) { if (0 > $timeout) {
throw new InvalidArgumentException('Timeout must be a positive value'); throw new InvalidArgumentException('Timeout must be a non-negative value');
} }
$this->timeout = $timeout; $this->timeout = $timeout;

View file

@ -101,7 +101,7 @@ class FFMpeg extends Binary
if (!file_exists($pathfile)) { if (!file_exists($pathfile)) {
$this->logger->addError(sprintf('FFmpeg failed to open %s', $pathfile)); $this->logger->addError(sprintf('FFmpeg failed to open %s', $pathfile));
throw new InvalidArgumentException(sprintf('File %s does not exists', $pathfile)); throw new InvalidArgumentException(sprintf('File %s does not exist', $pathfile));
} }
$this->logger->addInfo(sprintf('FFmpeg opens %s', $pathfile)); $this->logger->addInfo(sprintf('FFmpeg opens %s', $pathfile));
@ -181,7 +181,6 @@ class FFMpeg extends Binary
$process = $builder->getProcess(); $process = $builder->getProcess();
$process->setTimeout($this->timeout); $process->setTimeout($this->timeout);
$this->logger->addInfo(sprintf('FFmpeg executes command %s', $process->getCommandline())); $this->logger->addInfo(sprintf('FFmpeg executes command %s', $process->getCommandline()));
try { try {
@ -191,7 +190,7 @@ class FFMpeg extends Binary
} }
if (!$process->isSuccessful()) { if (!$process->isSuccessful()) {
$this->logger->addError(sprintf('FFmpeg command failed : %s', $process->getErrorOutput())); $this->logger->addError(sprintf('FFmpeg command failed: %s', $process->getErrorOutput()));
$this->cleanupTemporaryFile($output); $this->cleanupTemporaryFile($output);
@ -277,7 +276,7 @@ class FFMpeg extends Binary
if (!$process->isSuccessful()) { if (!$process->isSuccessful()) {
$this->logger->addInfo(sprintf('FFmpeg command failed')); $this->logger->addInfo(sprintf('FFmpeg command failed'));
throw new RuntimeException(sprintf('Encoding failed : %s', $process->getErrorOutput())); throw new RuntimeException(sprintf('Encoding failed: %s', $process->getErrorOutput()));
} }
$this->logger->addInfo(sprintf('FFmpeg command successful')); $this->logger->addInfo(sprintf('FFmpeg command successful'));
@ -327,9 +326,9 @@ class FFMpeg extends Binary
} }
if ($originalHeight !== null && $originalWidth !== null) { if ($originalHeight !== null && $originalWidth !== null) {
$this->logger->addInfo(sprintf('Read dimension for resizin succesful : %s x %s', $originalWidth, $originalHeight)); $this->logger->addInfo(sprintf('Read dimension for resizing succesful : %s x %s', $originalWidth, $originalHeight));
} else { } else {
$this->logger->addInfo(sprintf('Read dimension for resizin failed !')); $this->logger->addInfo(sprintf('Read dimension for resizing failed !'));
} }
if ($originalHeight !== null && $originalWidth !== null) { if ($originalHeight !== null && $originalWidth !== null) {