Initial commit
This commit is contained in:
24
src/IO/ExceptionHandler.php
Normal file
24
src/IO/ExceptionHandler.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace IO;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class ExceptionHandler
|
||||
{
|
||||
private static bool $registered = false;
|
||||
|
||||
public static function registerCallback(): void
|
||||
{
|
||||
if (self::$registered) {
|
||||
return;
|
||||
}
|
||||
|
||||
set_exception_handler(static function (Throwable $t) {
|
||||
print($t->getMessage());
|
||||
exit(1);
|
||||
});
|
||||
|
||||
self::$registered = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user