Skip to content

Commit

Permalink
fix: handle curl errors when fetching wiki info
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Jan 15, 2024
1 parent b7666ab commit 0b9240f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dist-persist/wbstack/src/Info/GlobalSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ private static function getInfoFromApi( $requestDomain ) {
curl_setopt( $client, CURLOPT_USERAGENT, "WBStack - MediaWiki - WBStackInfo::getInfoFromApi" );

$response = curl_exec($client);
if ($response === false) {
throw new GlobalSetException(
"Unexpected error getting wiki info from api: ".curl_error($client),
502,
);
}
$responseCode = intval(curl_getinfo($client, CURLINFO_RESPONSE_CODE));

if ($responseCode > 299) {
Expand Down
6 changes: 6 additions & 0 deletions dist/wbstack/src/Info/GlobalSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ private static function getInfoFromApi( $requestDomain ) {
curl_setopt( $client, CURLOPT_USERAGENT, "WBStack - MediaWiki - WBStackInfo::getInfoFromApi" );

$response = curl_exec($client);
if ($response === false) {
throw new GlobalSetException(
"Unexpected error getting wiki info from api: ".curl_error($client),
502,
);
}
$responseCode = intval(curl_getinfo($client, CURLINFO_RESPONSE_CODE));

if ($responseCode > 299) {
Expand Down

0 comments on commit 0b9240f

Please sign in to comment.