diff --git a/plugins/restful/RestfulEntityBase.php b/plugins/restful/RestfulEntityBase.php index 212697a5..172fed6b 100644 --- a/plugins/restful/RestfulEntityBase.php +++ b/plugins/restful/RestfulEntityBase.php @@ -1162,7 +1162,7 @@ protected function isValidEntity($op, $entity_id) { ); if (!$entity = entity_load_single($entity_type, $entity_id)) { - throw new RestfulUnprocessableEntityException(format_string('The entity ID @id for @resource does not exist.', $params)); + throw new RestfulNotFoundException(format_string('The entity ID @id for @resource does not exist.', $params)); } list(,, $bundle) = entity_extract_ids($entity_type, $entity); diff --git a/tests/RestfulExceptionHandleTestCase.test b/tests/RestfulExceptionHandleTestCase.test index e96d413a..1a21f57d 100644 --- a/tests/RestfulExceptionHandleTestCase.test +++ b/tests/RestfulExceptionHandleTestCase.test @@ -45,7 +45,7 @@ class RestfulExceptionHandleTestCase extends RestfulCurlBaseTestCase { $url = 'api/v1.0/articles/1'; $result = $this->httpRequest($url); $body = drupal_json_decode($result['body']); - $this->assertEqual($result['code'], '422', format_string('422 status code sent for @url url.', array('@url' => $url))); + $this->assertEqual($result['code'], '404', format_string('404 status code sent for @url url.', array('@url' => $url))); $this->assertTrue(strpos($result['headers'], 'application/problem+json;'), '"application/problem+json" found in invalid request.'); $this->assertEqual($body['title'], 'The entity ID 1 for Articles does not exist.', 'Correct error message.'); }