Merge pull request #95 from pmmp/timings-verbose

Make /timings command more verbose about errors
This commit is contained in:
Dylan K. Taylor 2016-11-10 08:48:09 +00:00 committed by GitHub
commit 0ac04b52ff

View File

@ -114,7 +114,15 @@ class TimingsCommand extends VanillaCommand{
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["User-Agent: " . $this->getName() . " " . $sender->getServer()->getPocketMineVersion()]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
try{
$data = curl_exec($ch);
if($data === false){
throw new \Exception(curl_error($ch));
}
}catch(\Exception $e){
$sender->getServer()->getLogger()->logException($e);
}
curl_close($ch);
if(preg_match('#^Location: http://paste\\.ubuntu\\.com/([0-9]{1,})/#m', $data, $matches) == 0){
$sender->sendMessage(new TranslationContainer("pocketmine.command.timings.pasteError"));