| 1 | <?php |
||
| 9 | class CommandFailed implements CommandEvent |
||
| 10 | { |
||
| 11 | use HasCommand, SerializesModels; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * The exception instance. |
||
| 15 | * |
||
| 16 | * @var \Exception|\Throwable |
||
| 17 | */ |
||
| 18 | protected $exception; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Whether the exception is caught, or not. |
||
| 22 | * |
||
| 23 | * @var bool |
||
| 24 | */ |
||
| 25 | protected $exceptionCaught = false; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Create a new "command failed" event object. |
||
| 29 | * |
||
| 30 | * @param object $command |
||
| 31 | * @param \Exception|\Throwable $exception |
||
| 32 | */ |
||
| 33 | public function __construct($command, $exception) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Return the exception instance. |
||
| 41 | * |
||
| 42 | * @return \Exception|\Throwable |
||
| 43 | */ |
||
| 44 | public function getException() |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Mark the exception as caught. |
||
| 51 | */ |
||
| 52 | public function catchException() |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Whether the exception is caught, or not. |
||
| 59 | * |
||
| 60 | * @return bool |
||
| 61 | */ |
||
| 62 | public function isExceptionCaught() |
||
| 66 | } |
||
| 67 |