<?php

use Weew\ErrorHandler\ErrorHandler;
use Weew\ErrorHandler\ErrorType;
require __DIR__ . '/../../../../vendor/autoload.php';
$errorHandler = new ErrorHandler();
$errorHandler->enableRecoverableErrorHandling();
$errorHandler->addRecoverableErrorHandler(function () {
    echo 'handled recoverable ';
    return true;
});
trigger_error('error', ErrorType::USER_ERROR);
echo 'continue';
 public function test_exception_from_recoverable_error_handler_is_handled()
 {
     $handler = new ErrorHandler();
     $recoverableError = new RecoverableError(ErrorType::ERROR, 'foo', 'bar', 'baz');
     $handler->addRecoverableErrorHandler(function (IError $error) {
         throw new Exception();
     });
     try {
         $handler->handleRecoverableError($recoverableError);
     } catch (Exception $ex) {
     }
 }