Finished Error handling across the API

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
Ryan Fletcher
2018-07-13 19:07:08 -04:00
committed by Julius Härtl
parent 2668f6b80c
commit dd1d4246fe
5 changed files with 34 additions and 44 deletions

View File

@@ -68,7 +68,7 @@ class CardApiController extends ApiController {
* Get a specific card.
*/
public function get() {
$boardError = $this->apiHelper->boardHasError($this->request->params['boardId'], $this->boardService);
$boardError = $this->apiHelper->entityHasError($this->request->params['boardId'], 'board', $this->boardService);
if ($boardError) {
return new DataResponse($boardError['message'], $boardError['status']);
}
@@ -104,7 +104,7 @@ class CardApiController extends ApiController {
*/
public function create($title, $type = 'plain', $order = 999) {
$boardError = $this->apiHelper->boardHasError($this->request->params['boardId'], 'board', $this->boardService);
$boardError = $this->apiHelper->entityHasError($this->request->params['boardId'], 'board', $this->boardService);
if ($boardError) {
return new DataResponse($boardError['message'], $boardError['status']);
}
@@ -148,7 +148,7 @@ class CardApiController extends ApiController {
*/
public function update($title, $type, $order, $description = null, $duedate = null, $archive = false, $assignedUserId = 0) {
$boardError = $this->apiHelper->boardHasError($this->request->params['boardId'], 'board', $this->boardService);
$boardError = $this->apiHelper->entityHasError($this->request->params['boardId'], 'board', $this->boardService);
if ($boardError) {
return new DataResponse($boardError['message'], $boardError['status']);
}
@@ -217,7 +217,7 @@ class CardApiController extends ApiController {
*/
public function delete() {
$boardError = $this->apiHelper->boardHasError($this->request->params['boardId'], 'board', $this->boardService);
$boardError = $this->apiHelper->entityHasError($this->request->params['boardId'], 'board', $this->boardService);
if ($boardError) {
return new DataResponse($boardError['message'], $boardError['status']);
}