. namespace core\output; use Slim\Interfaces\ErrorRendererInterface; use Throwable; // phpcs:disable moodle.NamingConventions.ValidVariableName.VariableNameLowerCase /** * Class routed_error_handler * * @package core * @copyright Andrew Lyons * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class routed_error_handler implements ErrorRendererInterface { #[\Override] public function __invoke(Throwable $exception, bool $displayErrorDetails): string { // @codeCoverageIgnoreStart if (defined('ABORT_AFTER_CONFIG') && !defined('ABORT_AFTER_CONFIG_CANCEL')) { define('ABORT_AFTER_CONFIG_CANCEL', true); require(__DIR__ . '/../../setup.php'); } // @codeCoverageIgnoreEnd if ($whoops = get_whoops()) { $whoops->sendHttpCode($exception->getCode()); $whoops->handleException($exception); } else { default_exception_handler($exception); } return ''; } }