erp/app/ExceptionHandler.php
2024-05-10 17:56:02 +08:00

26 lines
614 B
PHP

<?php
namespace App;
use app\common\service\JsonService;
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);
return json(json_decode($exception->getMessage(),true));
}
}