From 9cc637f0391af865f5284f62b9289ebfa1cc4d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 16 Dec 2020 15:32:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Route/Middleware.php | 1 - HttpServer/Route/Node.php | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/HttpServer/Route/Middleware.php b/HttpServer/Route/Middleware.php index 830c41ad..6cdee8b3 100644 --- a/HttpServer/Route/Middleware.php +++ b/HttpServer/Route/Middleware.php @@ -82,7 +82,6 @@ class Middleware [$controller, $action] = $node->handler; $attributes = Snowflake::app()->getAttributes(); $annotation = $attributes->getByClass(get_class($controller), $action); - var_dump($annotation); foreach ($annotation as $item) { if ($item instanceof Interceptor) { $node->addInterceptor($item->interceptor); diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 3145afcb..524c32cb 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -439,10 +439,14 @@ class Node extends Application return JSON::to(404, $node->_error ?? 'Page not found.'); } $requestParams = func_get_args(); - if (func_num_args() > 0) { - return call_user_func($this->callback, ...$requestParams); - } else { - return call_user_func($this->callback, \request()); + try { + if (func_num_args() > 0) { + return call_user_func($this->callback, ...$requestParams); + } else { + return call_user_func($this->callback, \request()); + } + } catch (Throwable $exception) { + var_dump($exception->getMessage()); } }