X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Fconfig%2FConfigJson.php;h=9ef2ef562634bb346cf398b290093cbd02e66926;hb=c6a4c2882d89c6bcceeeccd319549611a5d1801b;hp=30908d90db436574f9585d20d6b437f29d56e363;hpb=7fc5f07492b9bfe58cb33907ceb42e9bccd624ce;p=github%2Fshaarli%2FShaarli.git
diff --git a/application/config/ConfigJson.php b/application/config/ConfigJson.php
index 30908d90..9ef2ef56 100644
--- a/application/config/ConfigJson.php
+++ b/application/config/ConfigJson.php
@@ -21,8 +21,14 @@ class ConfigJson implements ConfigIO
$data = str_replace(self::getPhpSuffix(), '', $data);
$data = json_decode($data, true);
if ($data === null) {
- $error = json_last_error();
- throw new \Exception('An error occurred while parsing JSON file: error code #'. $error);
+ $errorCode = json_last_error();
+ $error = 'An error occurred while parsing JSON configuration file ('. $filepath .'): error code #';
+ $error .= $errorCode. '
â ' . json_last_error_msg() .'
';
+ if ($errorCode === JSON_ERROR_SYNTAX) {
+ $error .= '
Please check your JSON syntax (without PHP comment tags) using a JSON lint tool such as ';
+ $error .= 'jsonlint.com.';
+ }
+ throw new \Exception($error);
}
return $data;
}