/**
  * Handle an uncaught exception from the application.
  *
  * Note: Most exceptions can be handled via the try / catch block in
  * the HTTP and Console kernels. But, fatal error exceptions must
  * be handled differently since they are not normal exceptions.
  *
  * @param  \Exception $e
  * @throws Exception
  */
 public function handleException($e)
 {
     if (!getenv('APP_DEBUG')) {
         $this->tracker->report($e);
     }
     throw $e;
     // throw back to core PHP to render
 }
 function it_doesnt_report_when_in_debug()
 {
     // Arrange.
     putenv('APP_DEBUG=1');
     $exception = new Exception();
     // Act & Assert.
     $this->shouldThrow(Exception::class)->duringHandleException($exception);
     $this->tracker->report($exception)->shouldNotHaveBeenCalled();
 }
 function it_should_throw_an_exception_on_no_reports(Tracker $t1, Tracker $t2, Tracker $t3)
 {
     // Arrange.
     $exception = new InvalidArgumentException('error in app');
     $extra = ['phpspec' => 'test'];
     $t1->report($exception, $extra)->willThrow(new Exception('t1 throw'));
     $t2->report($exception, $extra)->willThrow(new Exception('t2 throw'));
     $t3->report($exception, $extra)->willThrow(new Exception('t3 throw'));
     $this->add($t1);
     $this->add($t2);
     $this->add($t3);
     // Act & Assert..
     $this->shouldThrow(GroupNotReported::class)->duringReport($exception, $extra);
 }