Skip to content

Commit ca9d839

Browse files
authored
Merge pull request #6 from isszz/patch-3
HttpResponseException跳过whoops
2 parents 66845b2 + 47942a4 commit ca9d839

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/Hander/Whoops.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
namespace think\Whoops\Hander;
66

77
use think\App;
8-
use think\exception\Handle;
98
use think\Response;
9+
use think\exception\Handle;
10+
use think\exception\HttpResponseException;
1011
use think\Whoops\Runner;
1112
use Throwable;
1213
use Whoops\Handler\JsonResponseHandler;
@@ -26,9 +27,14 @@ public function render($request, Throwable $e): Response
2627
{
2728
// Whoops 接管请求异常
2829
if (config('whoops.enable') && $this->app->isDebug()) {
30+
31+
if ($e instanceof HttpResponseException) {
32+
return $e->getResponse();
33+
}
34+
2935
$this->runner->pushHandler(new PrettyPageHandler());
3036

31-
// 兼容 Cors请求(一些调试接口插件)
37+
// 兼容 Cors请求
3238
if ($request->isAjax() || (isset($_SERVER['HTTP_SEC_FETCH_MODE']) && $_SERVER['HTTP_SEC_FETCH_MODE'] === 'cors')) {
3339
$this->runner->pushHandler(new JsonResponseHandler());
3440
}

0 commit comments

Comments
 (0)