mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Changed how exceptions work and are logged, throw proper exceptions on tasks
This commit is contained in:
@ -39,16 +39,27 @@ abstract class AsyncTask extends \Collectable{
|
||||
/** @var int */
|
||||
private $taskId = null;
|
||||
|
||||
private $crashed = false;
|
||||
|
||||
public function run(){
|
||||
$this->result = null;
|
||||
|
||||
if($this->cancelRun !== true){
|
||||
$this->onRun();
|
||||
try{
|
||||
$this->onRun();
|
||||
}catch(\Throwable $e){
|
||||
$this->crashed = true;
|
||||
$this->worker->handleException($e);
|
||||
}
|
||||
}
|
||||
|
||||
$this->setGarbage();
|
||||
}
|
||||
|
||||
public function isCrashed(){
|
||||
return $this->crashed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
Reference in New Issue
Block a user