/** * Handle exception using associated application dispatcher. * * @param \Exception $exception */ public function handleException($exception) { restore_error_handler(); restore_exception_handler(); /** * @var SnapshotInterface $snapshot */ $snapshot = $this->get(SnapshotInterface::class, compact('exception')); //Reporting $snapshot->report(); if (!empty($this->dispatcher)) { //Now dispatcher can handle snapshot it's own way $this->dispatcher->handleSnapshot($snapshot); } else { echo $snapshot; } }
/** * Handle exception using associated application dispatcher and snapshot class. * * @param \Exception $exception Works well in PHP7. */ public function handleException($exception) { restore_error_handler(); restore_exception_handler(); if (empty($snapshot = $this->getSnapshot($exception))) { //No action is required return; } //Let's allow snapshot to report about itself $snapshot->report(); if (!empty($this->dispatcher)) { //Now dispatcher can handle snapshot it's own way $this->dispatcher->handleSnapshot($snapshot); } else { echo $snapshot->getException(); } }