source: branches/2.5/prototype/library/Symfony/Component/Process/Exception/ProcessFailedException.php @ 7578

Revision 7578, 1.1 KB checked in by angelo, 12 years ago (diff)

Ticket #3197 - Reduzir tempo de carregamento do modulo Expresso Mail

Line 
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
12namespace Symfony\Component\Process\Exception;
13
14use Symfony\Component\Process\Process;
15
16/**
17 * Exception for failed processes.
18 *
19 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
20 */
21class 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(
32            sprintf(
33                'The command "%s" failed.'."\n\nOutput:\n================\n".$process->getOutput()."\n\nError Output:\n================\n".$process->getErrorOutput(),
34                $process->getCommandLine()
35            )
36        );
37
38        $this->process = $process;
39    }
40
41    public function getProcess()
42    {
43        return $this->process;
44    }
45}
Note: See TracBrowser for help on using the repository browser.