diff --git a/src/Symfony/Component/Process/Exception/ExceptionInterface.php b/src/Symfony/Component/Process/Exception/ExceptionInterface.php new file mode 100755 index 0000000000..2342a11d3c --- /dev/null +++ b/src/Symfony/Component/Process/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Exception; + +/** + * Marker Interface for the Process Component. + * + * @author Johannes M. Schmitt + */ +interface ExceptionInterface +{ +} \ No newline at end of file diff --git a/src/Symfony/Component/Process/Exception/ProcessFailedException.php b/src/Symfony/Component/Process/Exception/ProcessFailedException.php new file mode 100755 index 0000000000..c158d91fe8 --- /dev/null +++ b/src/Symfony/Component/Process/Exception/ProcessFailedException.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Exception; + +use Symfony\Component\Process\Process; + +/** + * Exception for failed processes. + * + * @author Johannes M. Schmitt + */ +class ProcessFailedException extends RuntimeException +{ + private $process; + + public function __construct(Process $process) + { + if ($process->isSuccessful()) { + throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.'); + } + + parent::__construct(sprintf('The command "%s" failed.'."\n\nOutput:\n================\n".$process->getOutput()."\n\nError Output:\n================\n".$process->getErrorOutput())); + + $this->process = $process; + } + + public function getProcess() + { + return $this->process; + } +} diff --git a/src/Symfony/Component/Process/Exception/RuntimeException.php b/src/Symfony/Component/Process/Exception/RuntimeException.php new file mode 100755 index 0000000000..e34e3840d4 --- /dev/null +++ b/src/Symfony/Component/Process/Exception/RuntimeException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Exception; + +/** + * RuntimeException for the Process Component. + * + * @author Johannes M. Schmitt + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} \ No newline at end of file