Corrected exception handling, the app must stop the execution and through the exception response.

This commit is contained in:
Alex Tselegidis 2016-07-09 13:19:07 +02:00
parent 523f4a3e76
commit 02ac330b3b

View file

@ -46,7 +46,7 @@ class API_V1_Controller extends CI_Controller {
$authorization = new \EA\Engine\Api\V1\Authorization($this); $authorization = new \EA\Engine\Api\V1\Authorization($this);
$authorization->basic($username, $password); $authorization->basic($username, $password);
} catch(\Exception $exception) { } catch(\Exception $exception) {
$this->_handleException($exception); exit($this->_handleException($exception));
} }
} }
@ -56,7 +56,7 @@ class API_V1_Controller extends CI_Controller {
protected function _requestAuthentication() { protected function _requestAuthentication() {
header('WWW-Authenticate: Basic realm="Easy!Appointments"'); header('WWW-Authenticate: Basic realm="Easy!Appointments"');
header('HTTP/1.0 401 Unauthorized'); header('HTTP/1.0 401 Unauthorized');
echo 'You are not authorized to use the API.'; exit('You are not authorized to use the API.');
} }
/** /**