Skip to content

Commit 9fdd068

Browse files
committed
handle http lookup exception
1 parent 7c18182 commit 9fdd068

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Lookup/HttpLookupService.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ protected function parseTopic(string $topic): array
118118
/**
119119
* @param string $url
120120
* @return array
121+
* @throws RuntimeException
121122
*/
122123
protected function request(string $url): array
123124
{
@@ -138,8 +139,12 @@ protected function request(string $url): array
138139
$headers[] = 'Authorization: Bearer ' . $auth->authData();
139140
}
140141
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
141-
$result = json_decode(curl_exec($ch), true);
142+
$response = curl_exec($ch);
143+
$result = json_decode($response, true);
142144
curl_close($ch);
145+
if (!is_array($result)) {
146+
throw new RuntimeException('Pulsar Connect Failed');
147+
}
143148
return $result;
144149
}
145150

0 commit comments

Comments
 (0)