diff options
author | Phil Burton <phil@d3r.com> | 2015-12-09 14:47:48 +0000 |
---|---|---|
committer | Phil Burton <phil@d3r.com> | 2015-12-09 14:47:48 +0000 |
commit | 075d8e7b5cd2606af5bbeaebd517a787a656e8ed (patch) | |
tree | 62ed9dec8c26e3dfb8748ce5167ab845d35d08ae /search.php | |
parent | cda15498f993c85e2c20351f0b248b05122e5705 (diff) |
Only add red errors when they are config/code errors
Diffstat (limited to 'search.php')
-rw-r--r-- | search.php | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -22,20 +22,20 @@ function getConfig() throw new Exception('File config.ini does not exist'); } if (!$config = parse_ini_file("config.ini")) { - throw new Exception('Could not parse ini file'); + throw new Exception('Could not parse ini file', 1); } if (!isset($config["url"])) { - throw new Exception('`url` not found in ini file'); + throw new Exception('`url` not found in ini file', 1); } if (!isset($config["command"])) { - throw new Exception('`command` not found in ini file'); + throw new Exception('`command` not found in ini file', 1); } // Set default page size if it's not in the config if (!isset($config["pagesize"])) { $config["pagesize"] = 3; } elseif (!is_int((int)$config["pagesize"]) || $config["pagesize"] < 1) { - throw new Exception('Page size ' . $config["pagesize"] . ' not valid in config'); + throw new Exception('Page size ' . $config["pagesize"] . ' not valid in config', 1); } // hash the password if (isset($config['password'])) { @@ -67,7 +67,8 @@ function getJsonFromUrl($config) "Could not retrive JSON from http server `" . $config["url"] . "?format=json` using password=" - . (isset($config["hash"]) ? "true" : "false") + . (isset($config["hash"]) ? "true" : "false"), + 1 ); } return $output; @@ -275,5 +276,5 @@ try { output($out); } catch (Exception $e) { - output($e->getMessage(), " - ", true); + output($e->getMessage(), " - ", ($e->getCode() == 1)); } |