Update error handling
This commit is contained in:
parent
5cefda4ff2
commit
144e723431
|
@ -551,7 +551,7 @@ return [
|
|||
],
|
||||
Exception::GRAPHQL_NO_QUERY => [
|
||||
'name' => Exception::GRAPHQL_NO_QUERY,
|
||||
'description' => 'Query is required.',
|
||||
'description' => 'No query supplied.',
|
||||
'code' => 400,
|
||||
],
|
||||
Exception::GRAPHQL_INVALID_QUERY => [
|
||||
|
@ -561,7 +561,7 @@ return [
|
|||
],
|
||||
Exception::GRAPHQL_TOO_MANY_QUERIES => [
|
||||
'name' => Exception::GRAPHQL_TOO_MANY_QUERIES,
|
||||
'description' => 'Too many queries have been sent in the same request.',
|
||||
'description' => 'Too many queries.',
|
||||
'code' => 400,
|
||||
],
|
||||
];
|
||||
|
|
|
@ -118,14 +118,14 @@ function executeRequest(
|
|||
$query = [$query];
|
||||
}
|
||||
if (empty($query)) {
|
||||
throw new Exception('No query supplied.', 400, Exception::GRAPHQL_NO_QUERY);
|
||||
throw new Exception(Exception::GRAPHQL_NO_QUERY);
|
||||
}
|
||||
if (\count($query) > $maxBatchSize) {
|
||||
throw new Exception('Too many queries.', 400, Exception::GRAPHQL_TOO_MANY_QUERIES);
|
||||
throw new Exception(Exception::GRAPHQL_TOO_MANY_QUERIES);
|
||||
}
|
||||
foreach ($query as $item) {
|
||||
if (empty($item['query'])) {
|
||||
throw new Exception('Invalid query.', 400, Exception::GRAPHQL_INVALID_QUERY);
|
||||
throw new Exception(Exception::GRAPHQL_INVALID_QUERY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue