You are here

class ConsoleExceptionEvent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Event/ConsoleExceptionEvent.php \Symfony\Component\Console\Event\ConsoleExceptionEvent

Allows to handle exception thrown in a command.

@author Fabien Potencier <fabien@symfony.com>

Hierarchy

Expanded class hierarchy of ConsoleExceptionEvent

2 files declare their use of ConsoleExceptionEvent
Application.php in vendor/symfony/console/Application.php
ApplicationTest.php in vendor/symfony/console/Tests/ApplicationTest.php

File

vendor/symfony/console/Event/ConsoleExceptionEvent.php, line 23

Namespace

Symfony\Component\Console\Event
View source
class ConsoleExceptionEvent extends ConsoleEvent {
  private $exception;
  private $exitCode;
  public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode) {
    parent::__construct($command, $input, $output);
    $this
      ->setException($exception);
    $this->exitCode = (int) $exitCode;
  }

  /**
   * Returns the thrown exception.
   *
   * @return \Exception The thrown exception
   */
  public function getException() {
    return $this->exception;
  }

  /**
   * Replaces the thrown exception.
   *
   * This exception will be thrown if no response is set in the event.
   *
   * @param \Exception $exception The thrown exception
   */
  public function setException(\Exception $exception) {
    $this->exception = $exception;
  }

  /**
   * Gets the exit code.
   *
   * @return int The command exit code
   */
  public function getExitCode() {
    return $this->exitCode;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConsoleEvent::$command protected property
ConsoleEvent::$input private property
ConsoleEvent::$output private property
ConsoleEvent::getCommand public function Gets the command that is executed.
ConsoleEvent::getInput public function Gets the input instance.
ConsoleEvent::getOutput public function Gets the output instance.
ConsoleExceptionEvent::$exception private property
ConsoleExceptionEvent::$exitCode private property
ConsoleExceptionEvent::getException public function Returns the thrown exception.
ConsoleExceptionEvent::getExitCode public function Gets the exit code.
ConsoleExceptionEvent::setException public function Replaces the thrown exception.
ConsoleExceptionEvent::__construct public function Overrides ConsoleEvent::__construct
Event::$dispatcher private property
Event::$name private property
Event::$propagationStopped private property
Event::getDispatcher Deprecated public function Returns the EventDispatcher that dispatches this Event.
Event::getName Deprecated public function Gets the event's name.
Event::isPropagationStopped public function Returns whether further event listeners should be triggered.
Event::setDispatcher Deprecated public function Stores the EventDispatcher that dispatches this Event.
Event::setName Deprecated public function Sets the event's name property.
Event::stopPropagation public function Stops the propagation of the event to further event listeners.