diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index cb03cedf5e79..c19a27c186f8 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -856,7 +856,7 @@ protected function display404errors(PageNotFoundException $e) } } - throw PageNotFoundException::forPageNotFound(); + throw PageNotFoundException::forPageNotFound($e->getMessage()); } //-------------------------------------------------------------------- diff --git a/system/Exceptions/PageNotFoundException.php b/system/Exceptions/PageNotFoundException.php index 8e6807f34174..7bd3d58505b4 100644 --- a/system/Exceptions/PageNotFoundException.php +++ b/system/Exceptions/PageNotFoundException.php @@ -8,9 +8,9 @@ class PageNotFoundException extends \OutOfBoundsException implements ExceptionIn */ protected $code = 404; - public static function forPageNotFound() + public static function forPageNotFound($Message) { - return new static(lang('HTTP.pageNotFound')); + return new static($Message ?? lang('HTTP.pageNotFound')); } public static function forEmptyController()