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
11 changes: 11 additions & 0 deletions src/Transport/ResultStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ public static function success(): self
return self::getInstance('SUCCESS');
}

/**
* Returns an instance of this enum representing the fact that the event
* failed to be sent because the content was too large.
*/
public static function contentTooLarge(): self
{
return self::getInstance('CONTENT_TOO_LARGE');
}

/**
* Returns an instance of this enum representing the fact that the event
* failed to be sent because of API rate limiting.
Expand Down Expand Up @@ -94,6 +103,8 @@ public static function createFromHttpStatusCode(int $statusCode): self
switch (true) {
case $statusCode >= 200 && $statusCode < 300:
return self::success();
case $statusCode === 413:
return self::contentTooLarge();
case $statusCode === 429:
return self::rateLimit();
case $statusCode >= 400 && $statusCode < 500:
Expand Down
12 changes: 12 additions & 0 deletions tests/Transport/HttpTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ public static function sendDataProvider(): iterable
],
];

yield [
new Response(413, [], ''),
ResultStatus::contentTooLarge(),
false,
[
'info' => [
'Sending event [%s] to %s [project:%s].',
'Sent event [%s] to %s [project:%s]. Result: "content_too_large" (status: 413).',
],
],
];

ClockMock::withClockMock(1644105600);

yield [
Expand Down