Skip to content

Commit b9400f7

Browse files
author
Jeremiah VALERIE
committed
Return more explicit message if user don't have rights.
1 parent 631e5ff commit b9400f7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Resolver/ConfigResolver.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Overblog\GraphQLBundle\Definition\Argument;
1616
use Overblog\GraphQLBundle\Definition\ArgsInterface;
1717
use Overblog\GraphQLBundle\Definition\FieldInterface;
18+
use Overblog\GraphQLBundle\Error\UserError;
1819
use Overblog\GraphQLBundle\Relay\Connection\Output\Connection;
1920
use Overblog\GraphQLBundle\Relay\Connection\Output\Edge;
2021
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
@@ -265,7 +266,11 @@ private function resolveAccessAndWrapResolveCallback($expression, callable $reso
265266
$access = false;
266267
}
267268

268-
return (bool) $access;
269+
if (!$access) {
270+
throw new UserError('Access denied to this field.');
271+
}
272+
273+
return true;
269274
};
270275

271276
if (is_array($result) || $result instanceof \ArrayAccess) {

0 commit comments

Comments
 (0)