Skip to content

Commit f973285

Browse files
committed
Guard against unexpected panic conditions from wings
1 parent 18e5ce3 commit f973285

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/Exceptions/Http/Connection/DaemonConnectionException.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ public function __construct(GuzzleException $previous, bool $useStatusCode = tru
3838

3939
if ($useStatusCode) {
4040
$this->statusCode = is_null($response) ? $this->statusCode : $response->getStatusCode();
41+
// There are rare conditions where wings encounters a panic condition and crashes the
42+
// request being made after content has already been sent over the wire. In these cases
43+
// you can end up with a "successful" response code that is actual an error.
44+
//
45+
// Handle those better here since we shouldn't ever end up in this exception state and
46+
// be returning a 2XX level response.
47+
if ($this->statusCode < 400) {
48+
$this->statusCode = Response::HTTP_BAD_GATEWAY;
49+
}
4150
}
4251

4352
if (is_null($response)) {

0 commit comments

Comments
 (0)