Make /timings command more verbose about errors

This commit is contained in:
Dylan K. Taylor 2016-11-09 22:09:16 +00:00
parent d696049a0a
commit 2d37d361a7

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"));