You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Controller/GraphqliteController.php
+6-9Lines changed: 6 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -117,25 +117,22 @@ private function handlePsr7Request(ServerRequestInterface $request): JsonRespons
117
117
privatefunctiondecideHttpStatusCode(ExecutionResult$result): int
118
118
{
119
119
// If the data entry in the response has any value other than null (when the operation has successfully executed without error) then the response should use the 200 (OK) status code.
120
-
if ($result->data !== null) {
121
-
return200;
122
-
}
123
-
124
-
if (empty($result->errors)) {
120
+
if ($result->data !== null || empty($result->errors)) {
125
121
return200;
126
122
}
127
123
128
124
$status = 0;
129
125
// There might be many errors. Let's return the highest code we encounter.
130
126
foreach ($result->errorsas$error) {
131
-
if ($error->getCategory() === Error::CATEGORY_GRAPHQL) {
132
-
$code = 400;
133
-
} else {
134
-
$code = $error->getCode();
127
+
$wrappedException = $error->getPrevious();
128
+
if ($wrappedException !== null) {
129
+
$code = $wrappedException->getCode();
135
130
if (!isset(Response::$statusTexts[$code])) {
136
131
// The exception code is not a valid HTTP code. Let's ignore it
0 commit comments