Changed how exceptions work and are logged, throw proper exceptions on tasks

This commit is contained in:
Shoghi Cervantes
2015-09-18 12:03:24 +02:00
parent 472fcfa4c7
commit 0bcf639a98
15 changed files with 52 additions and 78 deletions

View File

@ -51,10 +51,7 @@ class FormattedCommandAlias extends Command{
$sender->sendMessage(TextFormat::RED . $e->getMessage());
}else{
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.exception"));
$logger = $sender->getServer()->getLogger();
if($logger instanceof MainLogger){
$logger->logException($e);
}
$sender->getServer()->getLogger()->logException($e);
}
return false;

View File

@ -196,10 +196,7 @@ class SimpleCommandMap implements CommandMap{
}catch(\Throwable $e){
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.exception"));
$this->server->getLogger()->critical($this->server->getLanguage()->translateString("pocketmine.command.exception", [$commandLine, (string) $target, $e->getMessage()]));
$logger = $sender->getServer()->getLogger();
if($logger instanceof MainLogger){
$logger->logException($e);
}
$sender->getServer()->getLogger()->logException($e);
}
$target->timings->stopTiming();