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

@ -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
*/