Commit | Line | Data |
---|---|---|
132ec342 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
41498ac5 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
132ec342 | 5 | | | |
41498ac5 TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
132ec342 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
132ec342 TO |
11 | |
12 | namespace Civi\API\Event; | |
13 | ||
6550386a | 14 | /** |
39b870b8 TO |
15 | * Handle any exceptions that occur while processing an API request. |
16 | * | |
17 | * Event name: 'civi.api.exception' | |
6550386a | 18 | */ |
132ec342 TO |
19 | class ExceptionEvent extends Event { |
20 | ||
21 | /** | |
22 | * @var \Exception | |
23 | */ | |
24 | private $exception; | |
25 | ||
6550386a | 26 | /** |
8882ff5c TO |
27 | * @param \Exception $exception |
28 | * The exception which arose while processing the API request. | |
29 | * @param \Civi\API\Provider\ProviderInterface $apiProvider | |
30 | * The API provider responsible for executing the request. | |
31 | * @param array $apiRequest | |
32 | * The full description of the API request. | |
c98e9ee3 TO |
33 | * @param \Civi\API\Kernel $apiKernel |
34 | * The kernel which fired the event. | |
6550386a | 35 | */ |
c98e9ee3 | 36 | public function __construct($exception, $apiProvider, $apiRequest, $apiKernel) { |
132ec342 | 37 | $this->exception = $exception; |
c98e9ee3 | 38 | parent::__construct($apiProvider, $apiRequest, $apiKernel); |
132ec342 TO |
39 | } |
40 | ||
41 | /** | |
42 | * @return \Exception | |
43 | */ | |
44 | public function getException() { | |
45 | return $this->exception; | |
46 | } | |
96025800 | 47 | |
132ec342 | 48 | } |