Webmozart\Console\Api\Config\ApplicationConfig::isExceptionCaught PHP Method

isExceptionCaught() public method

Returns whether the application catches and displays exceptions thrown while running a command.
See also: setCatchExceptions()
public isExceptionCaught ( ) : boolean
return boolean Returns `true` if exceptions are caught and `false` otherwise.
    public function isExceptionCaught()
    {
        return $this->catchExceptions;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function run(RawArgs $args = null, InputStream $inputStream = null, OutputStream $outputStream = null, OutputStream $errorStream = null)
 {
     // Render errors to the preliminary IO until the final IO is created
     $io = $this->preliminaryIo;
     try {
         if (null === $args) {
             $args = new ArgvArgs();
         }
         $ioFactory = $this->config->getIOFactory();
         if (null === $ioFactory) {
             throw new LogicException('The IO factory must be set.');
         }
         /** @var IO $io */
         $io = call_user_func($ioFactory, $this, $args, $inputStream, $outputStream, $errorStream);
         $resolvedCommand = $this->resolveCommand($args);
         $command = $resolvedCommand->getCommand();
         $parsedArgs = $resolvedCommand->getArgs();
         $statusCode = $command->handle($parsedArgs, $io);
     } catch (Exception $e) {
         if (!$this->config->isExceptionCaught()) {
             throw $e;
         }
         $trace = new ExceptionTrace($e);
         $trace->render($io);
         $statusCode = $this->exceptionToExitCode($e->getCode());
     }
     if ($this->config->isTerminatedAfterRun()) {
         exit($statusCode);
     }
     return $statusCode;
 }
All Usage Examples Of Webmozart\Console\Api\Config\ApplicationConfig::isExceptionCaught