I can't catch the error with the Exception
PHP class.
<?php
require "vendor/autoload.php";
use App\Events\Logger;
use Exception;
/* Alterntly id tryed to use this call but dosnt work either use \Exception as Exception; */
$logger = new Logger("error.log", "ERROR");
try {
new DosentExist(); //I force the exception.
} catch (Exception $e) {
echo "error";
$error = new Error($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
$logger->log((string) $error, "ERROR");
}
Console error:
$ php index.php
Fatal error: Uncaught Error: Class "DosentExist" not found in C:\code\php\logs-forfun\index.php:10
Stack trace:
#0 {main}
thrown in C:\code\php\logs-forfun\index.php on line 10