setExceptionHandler() public méthode

This function sets the sandbox exception handler. The handler accepts the thrown exception and the sandbox instance as arguments. If the exception handler does not handle exceptions correctly then the sandbox's security may become compromised!
public setExceptionHandler ( callable $handler )
$handler callable Callable to handle thrown exceptions
 /**
  * Test whether sandbox converts errors to exceptions
  */
 public function testConvertErrors()
 {
     $this->expectException('ErrorException');
     $this->sandbox->convert_errors = true;
     $this->sandbox->setExceptionHandler(function ($error) {
         throw $error;
     });
     $this->sandbox->execute(function () {
         $a[1];
     });
 }