diff --git a/src/Api/Response.php b/src/Api/Response.php index 8c89799a5..27c97af4f 100644 --- a/src/Api/Response.php +++ b/src/Api/Response.php @@ -13,4 +13,9 @@ class Response { return json_decode($this->response->getBody()); } + + public function getStatusCode() + { + return $this->response->getStatusCode(); + } } diff --git a/src/Forum/Actions/DiscussionAction.php b/src/Forum/Actions/DiscussionAction.php index ee545cdca..1de63268b 100644 --- a/src/Forum/Actions/DiscussionAction.php +++ b/src/Forum/Actions/DiscussionAction.php @@ -1,6 +1,7 @@ apiClient->send($actor, $action, $params)->getBody(); + $response = $this->apiClient->send($actor, $action, $params); + $statusCode = $response->getStatusCode(); + + if ($statusCode === 404) { + throw new RouteNotFoundException; + } + + return $response->getBody(); } }