From ba4aa48e47cd782f9c61f59a1890696d1aa3f117 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Sun, 10 Jul 2016 12:59:04 +0200 Subject: [PATCH] Added new method for returning common 404 exceptions. --- src/application/controllers/api/v1/API_V1_Controller.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/application/controllers/api/v1/API_V1_Controller.php b/src/application/controllers/api/v1/API_V1_Controller.php index 28be2367..d166094c 100644 --- a/src/application/controllers/api/v1/API_V1_Controller.php +++ b/src/application/controllers/api/v1/API_V1_Controller.php @@ -81,6 +81,15 @@ class API_V1_Controller extends CI_Controller { echo json_encode($error, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); } + + /** + * Throw an API exception stating that the requested record was not found. + * + * @throws \EA\Engine\Api\V1\Exception + */ + protected function _throwRecordNotFound() { + throw new \EA\Engine\Api\V1\Exception('The requested record was not found!', 404, 'Not Found'); + } } /* End of file API_V1_Controller.php */