Add moar debug

This commit is contained in:
James Cole 2023-06-29 11:47:08 +02:00
parent 05d190659a
commit ad0a1b9a24

View File

@ -111,9 +111,11 @@ class StandardWebhookSender implements WebhookSenderInterface
try {
$res = $client->request('POST', $this->message->webhook->url, $options);
} catch (RequestException | ConnectException $e) {
Log::error('The webhook could NOT be submitted but Firefly III caught the error below.');
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
$logs = sprintf("%s\n%s", $e->getMessage(), $e->getTraceAsString());
$this->message->errored = true;
@ -125,6 +127,9 @@ class StandardWebhookSender implements WebhookSenderInterface
$attempt->status_code = 0;
if (method_exists($e, 'hasResponse') && method_exists($e, 'getResponse')) {
$attempt->status_code = $e->hasResponse() ? $e->getResponse()->getStatusCode() : 0;
Log::error(sprintf('The status code of the error response is: %d', $attempt->status_code));
$body = (string)($e->hasResponse() ? $e->getResponse()->getBody() : '');
Log::error(sprintf('The body of the error response is: %s', $body));
}
$attempt->logs = $logs;
$attempt->save();