Skip to content

Commit c4409a7

Browse files
authored
fix: Handle curl errors for single graphQL (DenverCoder1#402)
1 parent 772e4f1 commit c4409a7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/stats.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ function fetchGraphQL(string $query): stdClass
168168
if ($obj && $obj->message) {
169169
throw new AssertionError("Error: $obj->message \n<!-- $response -->", 401);
170170
}
171+
// Handle curl errors
172+
if (curl_errno($ch)) {
173+
throw new AssertionError("cURL error: " . curl_error($ch) . "\n<!-- $response -->", 500);
174+
}
171175
throw new AssertionError("An error occurred when getting a response from GitHub.\n<!-- $response -->", 502);
172176
}
173177
return $obj;

0 commit comments

Comments
 (0)