From 500a690cd0d9f0f753d610b2b537e84ba90b0af3 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Wed, 15 Oct 2014 18:35:42 +0200 Subject: [PATCH] Throw CRITICAL error message on unhandled Exception on commands instead of crashing --- src/pocketmine/command/SimpleCommandMap.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/command/SimpleCommandMap.php b/src/pocketmine/command/SimpleCommandMap.php index 13d7d75e8..571d833cf 100644 --- a/src/pocketmine/command/SimpleCommandMap.php +++ b/src/pocketmine/command/SimpleCommandMap.php @@ -178,7 +178,11 @@ class SimpleCommandMap implements CommandMap{ } $target->timings->startTiming(); - $target->execute($sender, $sentCommandLabel, $args); + try{ + $target->execute($sender, $sentCommandLabel, $args); + }catch(\Exception $e){ + $this->server->getLogger()->critical("Unhandled exception executing command '". $commandLine ,"' in ". $target); + } $target->timings->stopTiming(); return true;