Better error messages
This commit is contained in:
parent
68e43e49cf
commit
1d757658ff
|
@ -394,7 +394,7 @@ function _config_invalidate_cache($file, $cache_file) : ConfigCacheEntry
|
||||||
|
|
||||||
$pres = config_parse(config_base_dir(), $file);
|
$pres = config_parse(config_base_dir(), $file);
|
||||||
if($pres->error !== 0)
|
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);
|
$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)
|
function config_load_ex($conf_dir, $file, array $arr, $id = null)
|
||||||
{
|
{
|
||||||
if(!isset($arr['class']) || !isset($arr['class'][0]))
|
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'];
|
$klass = $arr['class'];
|
||||||
unset($arr['class']);
|
unset($arr['class']);
|
||||||
|
@ -751,12 +751,14 @@ function config_load_ex($conf_dir, $file, array $arr, $id = null)
|
||||||
$cnf = null;
|
$cnf = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if(!class_exists($klass))
|
||||||
|
throw new Exception("No such class '$klass'");
|
||||||
$cnf = new $klass;
|
$cnf = new $klass;
|
||||||
$cnf->import($arr, true);
|
$cnf->import($arr, true);
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
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;
|
$cnf->id = $id;
|
||||||
|
|
Loading…
Reference in New Issue