Error handling for StackApiController->Index()

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
Ryan Fletcher
2018-07-12 20:54:54 -04:00
committed by Julius Härtl
parent 0da84a3e8c
commit cec06493c0

View File

@@ -60,7 +60,12 @@ class StackApiController extends ApiController {
*/ */
public function index($boardId) { public function index($boardId) {
$stacks = $this->service->findAll($boardId); $stacks = $this->service->findAll($boardId);
return new DataResponse($stacks);
if ($stacks === false || $stacks === null) {
return new DataResponse("No Stacks Found", HTTP::STATUS_NOT_FOUND);
}
return new DataResponse($stacks, HTTP::STATUS_OK);
} }
/** /**