Files
scummvm-web/include/ExceptionHandler.php
T
Le Philousophe 261cca2dc3 WEB: Cleanup logic of exception handler
Also use isset to check if the Exception has been set.
2025-08-24 12:32:46 +02:00

44 lines
857 B
PHP

<?php
namespace ScummVM;
use ScummVM\Pages\SimplePage;
/**
* Handle uncaught exceptions.
*/
abstract class ExceptionHandler
{
private static $exception;
/* If the MenuModel cause the exception we need to skip them. */
public static function skipMenus()
{
if (!isset(self::$exception)) {
return false;
}
$e = self::$exception;
if (basename($e->getFile()) == 'MenuModel.php') {
return true;
}
foreach ($e->getTrace() as $t) {
if (basename($t['file'] ?? '') == 'MenuModel.php') {
return true;
}
}
return false;
}
/* Handle exceptions. */
public static function handleException($e)
{
self::$exception = $e;
$ep = new SimplePage('exception');
$ep->index($e);
}
}