Handle failures around subscription webhooks

This commit is contained in:
David Bomba 2023-01-17 11:39:19 +11:00
parent 8bc298daa4
commit 86a731ff47

View File

@ -51,7 +51,12 @@ trait SubscriptionHooker
$error = json_decode($e->getResponse()->getBody()->getContents());
if(property_exists($error, 'message'))
if(is_null($error)){
nlog("empty response");
nlog($e->getMessage());
}
if($error && property_exists($error, 'message'))
$message = $error->message;
return array_merge($body, ['message' => $message, 'status_code' => 500]);