Display exceptions from plugins while refreshing board

This commit is contained in:
Frédéric Guillot
2018-03-02 15:47:49 -08:00
parent f92eb448cb
commit b4beace91c

View File

@@ -2,6 +2,7 @@
namespace Kanboard\Controller; namespace Kanboard\Controller;
use Exception;
use Kanboard\Core\Controller\AccessForbiddenException; use Kanboard\Core\Controller\AccessForbiddenException;
use Kanboard\Model\UserMetadataModel; use Kanboard\Model\UserMetadataModel;
@@ -32,18 +33,22 @@ class BoardAjaxController extends BaseController
throw new AccessForbiddenException(e("You don't have the permission to move this task")); throw new AccessForbiddenException(e("You don't have the permission to move this task"));
} }
$result =$this->taskPositionModel->movePosition( try {
$project_id, $result =$this->taskPositionModel->movePosition(
$values['task_id'], $project_id,
$values['dst_column_id'], $values['task_id'],
$values['position'], $values['dst_column_id'],
$values['swimlane_id'] $values['position'],
); $values['swimlane_id']
);
if (! $result) { if (! $result) {
$this->response->status(400); $this->response->status(400);
} else { } else {
$this->response->html($this->renderBoard($project_id), 201); $this->response->html($this->renderBoard($project_id), 201);
}
} catch (Exception $e) {
$this->response->html('<div class="alert alert-error">'.$e->getMessage().'</div>');
} }
} }