mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Internet: only catch InternetExceptions - anything else is an unexpected fault condition
This commit is contained in:
parent
6614183c7f
commit
f3f229ef7c
@ -24,11 +24,12 @@ declare(strict_types=1);
|
||||
namespace pocketmine\scheduler;
|
||||
|
||||
use pocketmine\utils\Internet;
|
||||
use pocketmine\utils\InternetException;
|
||||
|
||||
/**
|
||||
* Executes a consecutive list of cURL operations.
|
||||
*
|
||||
* The result of this AsyncTask is an array of arrays (returned from {@link Utils::simpleCurl}) or RuntimeException objects.
|
||||
* The result of this AsyncTask is an array of arrays (returned from {@link Utils::simpleCurl}) or InternetException objects.
|
||||
*
|
||||
* @package pocketmine\scheduler
|
||||
*/
|
||||
@ -56,7 +57,7 @@ class BulkCurlTask extends AsyncTask{
|
||||
foreach($operations as $op){
|
||||
try{
|
||||
$results[] = Internet::simpleCurl($op["page"], $op["timeout"] ?? 10, $op["extraHeaders"] ?? [], $op["extraOpts"] ?? []);
|
||||
}catch(\RuntimeException $e){
|
||||
}catch(InternetException $e){
|
||||
$results[] = $e;
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ class Internet{
|
||||
try{
|
||||
list($ret, $headers, $httpCode) = self::simpleCurl($page, $timeout, $extraHeaders);
|
||||
return $ret;
|
||||
}catch(\RuntimeException $ex){
|
||||
}catch(InternetException $ex){
|
||||
$err = $ex->getMessage();
|
||||
return false;
|
||||
}
|
||||
@ -113,7 +113,7 @@ class Internet{
|
||||
CURLOPT_POSTFIELDS => $args
|
||||
]);
|
||||
return $ret;
|
||||
}catch(\RuntimeException $ex){
|
||||
}catch(InternetException $ex){
|
||||
$err = $ex->getMessage();
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user