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
privatefunctiondecideHttpStatusCode(ExecutionResult$result): int
127
-
{
128
-
// 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.
129
-
if ($result->data !== null || empty($result->errors)) {
130
-
return200;
131
-
}
132
-
133
-
$status = 0;
134
-
// There might be many errors. Let's return the highest code we encounter.
135
-
foreach ($result->errorsas$error) {
136
-
$wrappedException = $error->getPrevious();
137
-
if ($wrappedException !== null) {
138
-
$code = $wrappedException->getCode();
139
-
if (!isset(Response::$statusTexts[$code])) {
140
-
// The exception code is not a valid HTTP code. Let's ignore it
141
-
continue;
142
-
}
143
-
} else {
144
-
$code = 400;
145
-
}
146
-
$status = max($status, $code);
147
-
}
148
-
149
-
// If exceptions have been thrown and they have not a "HTTP like code", let's throw a 500.
0 commit comments