Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 57de69f

Browse filesBrowse files
committed
added an exception for failed processes
1 parent edac48a commit 57de69f
Copy full SHA for 57de69f

File tree

Expand file treeCollapse file tree

3 files changed

+82
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+82
-0
lines changed
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Process\Exception;
13+
14+
/**
15+
* Marker Interface for the Process Component.
16+
*
17+
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
18+
*/
19+
interface ExceptionInterface
20+
{
21+
}
+40Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Process\Exception;
13+
14+
use Symfony\Component\Process\Process;
15+
16+
/**
17+
* Exception for failed processes.
18+
*
19+
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
20+
*/
21+
class ProcessFailedException extends RuntimeException
22+
{
23+
private $process;
24+
25+
public function __construct(Process $process)
26+
{
27+
if ($process->isSuccessful()) {
28+
throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.');
29+
}
30+
31+
parent::__construct(sprintf('The command "%s" failed.'."\n\nOutput:\n================\n".$process->getOutput()."\n\nError Output:\n================\n".$process->getErrorOutput()));
32+
33+
$this->process = $process;
34+
}
35+
36+
public function getProcess()
37+
{
38+
return $this->process;
39+
}
40+
}
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Process\Exception;
13+
14+
/**
15+
* RuntimeException for the Process Component.
16+
*
17+
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
18+
*/
19+
class RuntimeException extends \RuntimeException implements ExceptionInterface
20+
{
21+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.