We are developing some PHP tool to get data from magento2 API. We are able to get all the details finely. Whenever there is an error we need to store them in catch exception for further reference.
We are trying to pass the wrong URL to magento2 for testing, It is giving following response with 404 error code.
{ "message": "Request does not match any route.", "trace": null }
Now I am unable to get this Message in my laravel code why because Guzzle throwing an exception as "Out of memory". I increased my Memory_Limit parameter to 1G, Again I changed to 2G nothing happened except the Out of memory issue.
Can somebody help me on this issue?
try {
$content = $this->client->get($endpoint, $this->options);
$status = $content->getStatusCode();
if($status == "200"){
$result_data = $this->response($content);
return json_decode(json_encode($result_data));
}
else{
throw new \Exception('Failed');
}
}
catch (BadResponseException $e) {
$response = json_encode((string)$e->getResponse()->getBody());
}