Skip to content

Commit 1c80068

Browse files
committed
Filtering only valid HTTP codes for mapping exceptions code to HTTP status code
1 parent dc6a209 commit 1c80068

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Controller/GraphqliteController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use GraphQL\Executor\Promise\Promise;
1313
use GraphQL\Server\StandardServer;
1414
use GraphQL\Upload\UploadMiddleware;
15+
use function in_array;
1516
use function json_decode;
1617
use Psr\Http\Message\ServerRequestInterface;
1718
use RuntimeException;
@@ -131,6 +132,10 @@ private function decideHttpStatusCode(ExecutionResult $result): int
131132
$code = 400;
132133
} else {
133134
$code = $error->getCode();
135+
if (!isset(Response::$statusTexts[$code])) {
136+
// The exception code is not a valid HTTP code. Let's ignore it
137+
continue;
138+
}
134139
}
135140
$status = max($status, $code);
136141
}

0 commit comments

Comments
 (0)