I have the following code for an API call.
try {
$response = $this->guzzleClient->request(
Request::METHOD_POST,
$url,
[
'json' => $payload,
]
);
} catch (BadResponseException $e) {
throw $e->getResponse();
}
But I am receiving following error for some wrong input.
(1/1) FatalThrowableError Cannot throw objects that do not implement Throwable
If I write NotFoundHttpException
instead of BadResponseException
it works. But that is not the solution.