From e3920f937a7b51a19a5c8c4b7d6aacd1b0a7a0e7 Mon Sep 17 00:00:00 2001 From: Tux Date: Fri, 12 May 2017 11:01:02 -0400 Subject: [PATCH] 0.2.1 --- plugin.yml | 2 +- src/Buycraft/PocketMine/Util/AnalyticsSend.php | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/plugin.yml b/plugin.yml index 14c8ab3..4b522a8 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,5 +1,5 @@ name: BuycraftPM main: Buycraft\PocketMine\BuycraftPlugin -version: 0.2 +version: 0.2.1 author: Tebex Limited api: [2.0.0, 3.0.0, 3.0.0-ALPHA4, 3.0.0-ALPHA5] \ No newline at end of file diff --git a/src/Buycraft/PocketMine/Util/AnalyticsSend.php b/src/Buycraft/PocketMine/Util/AnalyticsSend.php index 0323c59..1d73440 100644 --- a/src/Buycraft/PocketMine/Util/AnalyticsSend.php +++ b/src/Buycraft/PocketMine/Util/AnalyticsSend.php @@ -11,6 +11,7 @@ use Buycraft\PocketMine\BuycraftPlugin; use pocketmine\scheduler\AsyncTask; +use pocketmine\Server; class AnalyticsSend extends AsyncTask { @@ -60,10 +61,20 @@ public function onRun() curl_setopt($ctx, CURLOPT_FAILONERROR, true); $result = curl_exec($ctx); + $err = curl_error($ctx); curl_close($ctx); if ($result === FALSE) { - throw new \Exception("Unable to send analytics."); + $this->setResult("Unable to send analytics: " . $err); + } + } + + public function onCompletion(Server $server) + { + $err = $this->getResult(); + if ($err) + { + BuycraftPlugin::getInstance()->getLogger()->warning("Unable to send analytics: " . $err); } } } \ No newline at end of file