1
0
Fork 0
mirror of synced 2024-06-28 19:20:25 +12:00

Update error handling

This commit is contained in:
Jake Barnby 2022-09-21 18:36:43 +12:00
parent 5cefda4ff2
commit 144e723431
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
2 changed files with 5 additions and 5 deletions

View file

@ -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,
],
];

View file

@ -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);
}
}