Closed raraworks closed 5 years ago
It turns out we use the existence of the 'result' property to decide whether we're dealing with a result object or an error object.
Here's the corresponding line of code: https://github.com/datto/php-json-rpc/blob/4465221e4d40ffb7fdfd72a0bd86eb9a3b7a47df/src/Client.php#L213-L214
So! If there is no 'result' property, then the "getResult" function will return false and we'll end up fetching an error object instead.
Yes, this was correct.
The API I was connecting to, was not sending correct error object structure (error code was not an integer).
You are completely correct, thanks for clarification.
I might be incorrect, but it seems that when decoding response from JSON RPC server, and response contains error object, parameter result is requested where as per specification it is not required:
And so decode fails and throws an errorException.