Skip to content
Snippets Groups Projects

Fixed subrequest status not checked.

All threads resolved!
Files
2
+ 15
0
@@ -112,6 +112,21 @@ class EntityToJsonApi {
$request->setSession($this->session);
}
$response = $this->httpKernel->handle($request, HttpKernelInterface::SUB_REQUEST);
if (!$response->isOk()) {
$json = $response->getContent();
$data = Json::decode($json);
throw new \Exception(sprintf(
"Error making subrequest to JSON:API to get '%s' entity with ID '%s' of bundle '%s'. Status code %s with message '%s'.",
$entity->getEntityTypeId(),
$entity->id(),
$entity->bundle(),
$response->getStatusCode(),
$data['errors'][0]['detail'] ?? ''
));
}
return $response->getContent();
}
Loading