添加 app/ExceptionHandler.php

This commit is contained in:
mkm 2025-08-21 16:19:45 +08:00
parent 1fcf8f46ec
commit d0db2ec253

23
app/ExceptionHandler.php Normal file
View File

@ -0,0 +1,23 @@
<?php
namespace App;
use Next\VarDumper\Dumper;
use Next\VarDumper\DumperHandler;
use support\exception\Handler;
use Throwable;
use Webman\Http\Request;
use Webman\Http\Response;
class ExceptionHandler extends Handler
{
use DumperHandler;
public function render(Request $request, Throwable $exception): Response
{
if ($exception instanceof Dumper) {
return \response(self::convertToHtml($exception));
}
return parent::render($request, $exception);
}
}