From 151ec0c27b7c63b250bc47abed7f9bdce7709610 Mon Sep 17 00:00:00 2001 From: filesite Date: Wed, 30 Mar 2022 00:21:34 +0800 Subject: [PATCH] improve error message, hide realpath of layout file --- controller/Controller.php | 6 +++++- lib/FSC.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/controller/Controller.php b/controller/Controller.php index 7628c2b..9abdf87 100644 --- a/controller/Controller.php +++ b/controller/Controller.php @@ -47,7 +47,11 @@ Class Controller { ob_end_flush(); }else { - throw new Exception("Layout file not exist: {$layoutFile}", 500); + $error_message = "Layout file {$this->layout}.php is not exist."; + if (!empty(FSC::$app['config']['theme'])) { + $error_message = "Layout file {$this->layout}.php in theme " . FSC::$app['config']['theme'] . " is not exist."; + } + throw new Exception($error_message, 500); } } diff --git a/lib/FSC.php b/lib/FSC.php index 09aaf9d..294b290 100644 --- a/lib/FSC.php +++ b/lib/FSC.php @@ -98,9 +98,9 @@ Class FSC { throw new Exception($error_message, 500); } }else { - $error_message = "Controller {$className} not exist."; + $error_message = "Controller {$className}.php not exist."; if (!empty($config['theme'])) { - $error_message = "Controller {$className} not exist in theme {$config['theme']}."; + $error_message = "Controller {$className}.php not exist in theme {$config['theme']}."; } throw new Exception($error_message, 500); }