Fix missing message call.

This commit is contained in:
James Cole 2023-02-01 18:05:52 +01:00
parent 970193473d
commit 766418a894
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -56,7 +56,7 @@ class StandardWebhookSender implements WebhookSenderInterface
{ {
// have the signature generator generate a signature. If it fails, the error thrown will // have the signature generator generate a signature. If it fails, the error thrown will
// end up in send() to be caught. // end up in send() to be caught.
$signatureGenerator = app(SignatureGeneratorInterface::class); $signatureGenerator = app(SignatureGeneratorInterface::class);
$this->message->sent = true; $this->message->sent = true;
$this->message->save(); $this->message->save();
try { try {
@ -109,7 +109,7 @@ class StandardWebhookSender implements WebhookSenderInterface
]; ];
$client = new Client(); $client = new Client();
try { try {
$res = $client->request('POST', $this->message->webhook->url, $options); $res = $client->request('POST', $this->message->webhook->url, $options);
} catch (RequestException|ConnectException $e) { } catch (RequestException|ConnectException $e) {
Log::error($e->getMessage()); Log::error($e->getMessage());
Log::error($e->getTraceAsString()); Log::error($e->getTraceAsString());
@ -122,8 +122,11 @@ class StandardWebhookSender implements WebhookSenderInterface
$attempt = new WebhookAttempt(); $attempt = new WebhookAttempt();
$attempt->webhookMessage()->associate($this->message); $attempt->webhookMessage()->associate($this->message);
$attempt->status_code = $e->hasResponse() ? $e->getResponse()->getStatusCode() : 0; $attempt->status_code = 0;
$attempt->logs = $logs; if (method_exists($e, 'hasResponse') && method_exists($e, 'getResponse')) {
$attempt->status_code = $e->hasResponse() ? $e->getResponse()->getStatusCode() : 0;
}
$attempt->logs = $logs;
$attempt->save(); $attempt->save();
return; return;