Update error status return.

This commit is contained in:
kiswa 2014-10-24 12:31:51 -04:00
parent f059c4a683
commit 2476a4c7c1

View File

@ -17,9 +17,14 @@ require_once('helpers.php'); // Must come after $jsonResponse exists.
// Catch Exception if connection to DB failed
function exceptionHandler($exception) {
global $jsonResponse;
header('Content-Type: application/json');
http_response_code(503);
echo '{"message": "API Error."}';
$jsonResponse->message = 'API Error.';
$jsonResponse->data = $exception->getMessage();
echo $jsonResponse->asJson();
};
set_exception_handler('exceptionHandler');