Return HTTP 500 on configuration error
--- a/include/Config.class.php
+++ b/include/Config.class.php
@@ -78,11 +78,11 @@
global $gitphp_version, $gitphp_appstring;
if (!is_file($configFile)) {
- throw new Exception('Could not load config file ' . $configFile);
+ throw new GitPHP_MessageException('Could not load config file ' . $configFile, true, 500);
}
if (!include($configFile)) {
- throw new Exception('Could not read config file ' . $configFile);
+ throw new GitPHP_MessageException('Could not read config file ' . $configFile, true, 500);
}
if (isset($gitphp_conf) && is_array($gitphp_conf))
--- a/include/controller/Controller_Message.class.php
+++ b/include/controller/Controller_Message.class.php
@@ -137,6 +137,8 @@
private function StatusCodeHeader($code)
{
switch ($code) {
+ case 500:
+ return '500 Internal Server Error';
}
}
--- a/index.php
+++ b/index.php
@@ -110,7 +110,7 @@
}
if (!GitPHP_Config::GetInstance()->GetValue('projectroot', null)) {
- throw new GitPHP_MessageException(__('A projectroot must be set in the config'), true);
+ throw new GitPHP_MessageException(__('A projectroot must be set in the config'), true, 500);
}
/*