Merge pull request #23710 from eileenmcnaughton/civi_import
[civicrm-core.git] / Civi / Pipe / JsonRpcMethodException.php
1 <?php
2
3 namespace Civi\Pipe;
4
5 /**
6 * The JsonRpcMethodException is emitted by a JSON-RPC client if a method call returns an error.
7 *
8 * This differs from an protocol-error or client-error. In this case, all JSON-RPC traffic has
9 * been well-formed; but the payload indicates that a specific method-call failed.
10 */
11 class JsonRpcMethodException extends \CRM_Core_Exception {
12
13 /**
14 * @var array
15 * @readonly
16 */
17 public $raw;
18
19 public function __construct(array $jsonRpcError) {
20 parent::__construct($jsonRpcError['error']['message'] ?? 'Unknown JSON-RPC error',
21 $jsonRpcError['error']['code'] ?? 0,
22 $jsonRpcError['error']['data'] ?? []
23 );
24 $this->raw = $jsonRpcError;
25 }
26
27 }