Gracefully handle errors loading plugin manifest

this isn't perfect, but it covers the common cases.
Now, the server won't spam crashdumps just because some plugin declared nested permissions.
This commit is contained in:
Dylan K. Taylor
2021-10-05 20:28:43 +01:00
parent 7245d15abe
commit e25c03eec1
5 changed files with 25 additions and 5 deletions

View File

@ -246,6 +246,13 @@ class PluginManager{
}
try{
$description = $loader->getPluginDescription($file);
}catch(PluginDescriptionParseException $e){
$this->server->getLogger()->error($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_fileError(
$file,
$directory,
KnownTranslationFactory::pocketmine_plugin_invalidManifest($e->getMessage())
)));
continue;
}catch(\RuntimeException $e){ //TODO: more specific exception handling
$this->server->getLogger()->error($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_fileError($file, $directory, $e->getMessage())));
$this->server->getLogger()->logException($e);