-
-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Labels
Description
If a dereferenceable IRI is used in a request and no resource exists under this IRI, an
ItemNotFoundException
is thrown, which results in a response with status code 500 with the
following content:
{
"@context": "/api/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "Internal Server Error"
}
The content of the request was:
{
"product": "/api/products/not_existing"
}
This response is not very helpful for the user of the API. Therefore it would be better if such an
error could be converted into a validation error:
{
"@context": "/api/contexts/ConstraintViolationList",
"@type": "ConstraintViolationList",
"hydra:title": "An error occurred",
"hydra:description": "product: Item not found for \"/api/products/not_existing\".",
"violations": [
{
"propertyPath": "product",
"message": "Item not found for \"/api/products/not_existing\".",
"code": null
}
]
}
For this, we could use the mechanism by which type errors are collected during denormalization
(PartialDenormalizationException
).