modify
This commit is contained in:
@@ -478,14 +478,20 @@ class Router extends HttpService implements RouterInterface
|
|||||||
*/
|
*/
|
||||||
public function dispatch(): mixed
|
public function dispatch(): mixed
|
||||||
{
|
{
|
||||||
if (!($node = $this->find_path(\request()))) {
|
try {
|
||||||
return send(self::NOT_FOUND);
|
if (!($node = $this->find_path(\request()))) {
|
||||||
|
return send(self::NOT_FOUND);
|
||||||
|
}
|
||||||
|
send($response = $node->dispatch(), 200);
|
||||||
|
if (!$node->hasAfter()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $node->afterDispatch($response);
|
||||||
|
} catch (\Throwable $exception) {
|
||||||
|
$this->addError($exception);
|
||||||
|
|
||||||
|
return send($exception->getMessage(), 200);
|
||||||
}
|
}
|
||||||
send($response = $node->dispatch(), 200);
|
|
||||||
if (!$node->hasAfter()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $node->afterDispatch($response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user