This commit is contained in:
2025-08-13 19:09:29 +08:00
parent 275713f893
commit 75a410e376
3 changed files with 18 additions and 24 deletions

View File

@@ -1,22 +0,0 @@
<?php
namespace app\exception;
use RuntimeException;
use support\Response;
class HttpResponseException extends RuntimeException
{
protected $response;
// 接收 Response 实例作为参数
public function __construct(Response $response)
{
$this->response = $response;
}
// 获取响应对象
public function getResponse()
{
return $this->response;
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace app\exception;
use support\exception\BusinessException;
use Webman\Http\Request;
use Webman\Http\Response;
class MyBusinessException extends BusinessException
{
public function render(Request $request): ?Response
{
return new Response(200, ['Content-Type' => 'application/json'], $this->getMessage());
}
}