diff --git a/config.inc.php b/config.inc.php index 849b044..4fb2d75 100644 --- a/config.inc.php +++ b/config.inc.php @@ -394,7 +394,7 @@ function _config_invalidate_cache($file, $cache_file) : ConfigCacheEntry $pres = config_parse(config_base_dir(), $file); if($pres->error !== 0) - throw new Exception("Error({$pres->error}) while loading JSON from {$file}:\n" . $pres->error_descr); + throw new Exception("Error({$pres->error}) while loading JSON in file '{$file}':\n" . $pres->error_descr); $includes = config_get_module_includes($pres->jsm_module); @@ -740,7 +740,7 @@ function config_check_and_decode_jzon($json) function config_load_ex($conf_dir, $file, array $arr, $id = null) { if(!isset($arr['class']) || !isset($arr['class'][0])) - throw new Exception("Class is not set. File '$file'."); + throw new Exception("Class is not set in file '$file'."); $klass = $arr['class']; unset($arr['class']); @@ -751,12 +751,14 @@ function config_load_ex($conf_dir, $file, array $arr, $id = null) $cnf = null; try { + if(!class_exists($klass)) + throw new Exception("No such class '$klass'"); $cnf = new $klass; $cnf->import($arr, true); } catch(Exception $e) { - throw new Exception($e->getMessage() . ". File '{$file}'"/* . $e->getTraceAsString()*/); + throw new Exception($e->getMessage() . " in file '{$file}'"/* . $e->getTraceAsString()*/); } $cnf->id = $id;