Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Transport/HttpTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ public function send(Event $event): Result
['exception' => $exception, 'event' => $event]
);

// No response was received, so this is recorded like a failed connection
ClientReportAggregator::getInstance()->addEvent($event, Reason::networkError());

return new Result(ResultStatus::failed());
}

Expand Down
5 changes: 5 additions & 0 deletions tests/Transport/HttpTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ public static function sendDataProvider(): iterable

public function testSendFailsDueToHttpClientException(): void
{
SentrySdk::init()->bindClient(new Client(new Options([
'send_client_reports' => true,
]), StubTransport::getInstance()));

$exception = new \Exception('foo');
$event = Event::createEvent();

Expand Down Expand Up @@ -198,6 +202,7 @@ public function testSendFailsDueToHttpClientException(): void
$result = $transport->send($event);

$this->assertSame(ResultStatus::failed(), $result->getStatus());
$this->assertClientReports(['error' => ['network_error' => 1]]);
}

public function testRecordsClientReportWhenSerializationFails(): void
Expand Down
Loading