From 913231fb0656f7fcb3fb4d74c24604e816fa9b5d Mon Sep 17 00:00:00 2001 From: Andrew Sardone Date: Wed, 8 Apr 2015 10:31:34 -0400 Subject: [PATCH] Throw exception on JSON-RPC error in endpoint discovery --- NutshellApi.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NutshellApi.php b/NutshellApi.php index 8ef5978..460ec32 100755 --- a/NutshellApi.php +++ b/NutshellApi.php @@ -160,6 +160,9 @@ protected function _getApiEndpointForUser($username) { curl_close($curl); $decoded = $this->json_decode($result); + if ($decoded->error !== NULL) { + throw new NutshellApiException($decoded->error->message); + } return 'https://' . $decoded->result->api . '/api/v1/json'; }