We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae2e9a9 commit 9a4e0c6Copy full SHA for 9a4e0c6
1 file changed
src/think/Http.php
@@ -261,17 +261,22 @@ protected function renderException($request, Throwable $e)
261
return $this->app->make(Handle::class)->render($request, $e);
262
}
263
264
- /**
+/**
265
* HttpEnd
266
* @param Response $response
267
* @return void
268
*/
269
public function end(Response $response): void
270
{
271
- $this->app->event->trigger(HttpEnd::class, $response);
272
-
273
- //执行中间件
274
- $this->app->middleware->end($response);
+ try {
+ // 触发HttpEnd事件
+ $this->app->event->trigger(HttpEnd::class, $response);
+ // 执行中间件
275
+ $this->app->middleware->end($response);
276
+ } catch (Throwable $e) {
277
+ // 记录异常
278
+ $this->app->log->error($e->getMessage());
279
+ }
280
281
// 写入日志
282
$this->app->log->save();
0 commit comments