From 659b96f43c700c9c5099b12fe951babcc38a1f31 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Mon, 11 Jul 2022 13:30:28 +0300 Subject: RequestDispatcher: show handler-not-found message only in dev mode --- engine/RequestDispatcher.php | 4 +++- skin/error.skin.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/engine/RequestDispatcher.php b/engine/RequestDispatcher.php index ec31516..adb61c9 100644 --- a/engine/RequestDispatcher.php +++ b/engine/RequestDispatcher.php @@ -7,6 +7,8 @@ class RequestDispatcher { ) {} public function dispatch(): void { + global $config; + try { if (!in_array($_SERVER['REQUEST_METHOD'], ['POST', 'GET'])) throw new NotImplementedException('Method '.$_SERVER['REQUEST_METHOD'].' not implemented'); @@ -27,7 +29,7 @@ class RequestDispatcher { $handler_class = 'handler\\'.$handler_class; if (!class_exists($handler_class)) - throw new NotFoundException('Handler class "'.$handler_class.'" not found'); + throw new NotFoundException($config['is_dev'] ? 'Handler class "'.$handler_class.'" not found' : ''); $router_input = []; if (count($route) > 1) { diff --git a/skin/error.skin.php b/skin/error.skin.php index b0925d3..5276bfa 100644 --- a/skin/error.skin.php +++ b/skin/error.skin.php @@ -29,10 +29,10 @@ return <<$code $title

$code $title

+
{$ctx->if_true($message, - '

'.$message.'

' + '

'.$message.'

' )} - HTML; -- cgit v1.2.3