File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -108,12 +108,13 @@ public function retrieve ($action, array $params) {
108
108
$ this ->debug ("Querying URL: $ url " );
109
109
curl_setopt ($ this ->ch , CURLOPT_URL , $ url );
110
110
$ data = curl_exec ($ this ->ch );
111
+ $ decoded = json_decode ($ data );
111
112
112
- if (empty ($ data )) {
113
- throw new RuntimeException ("No data received from server. No Internet connection? " );
113
+ if (empty ($ decoded )) {
114
+ $ error_code = json_last_error ();
115
+ throw new RuntimeException ("Error retrieving data. No Internet connection? [ $ error_code] " );
114
116
}
115
117
116
- $ decoded = json_decode ($ data );
117
118
if (isset ($ decoded ->error )) {
118
119
$ code = $ decoded ->error ->code ;
119
120
$ msg = $ decoded ->error ->message ;
@@ -125,7 +126,7 @@ public function retrieve ($action, array $params) {
125
126
throw new LogicException ($ msg . " [Code: $ code] " );
126
127
}
127
128
128
- return json_decode ( $ data ) ;
129
+ return $ decoded ;
129
130
}
130
131
131
132
/**
You can’t perform that action at this time.
0 commit comments