Skip to content

Commit 66b3fcf

Browse files
ref!: throw runtime exception when missing field value
1 parent 1cedd31 commit 66b3fcf

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/Exception/LogicException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
namespace XGraphQL\DelegateExecution\Exception;
66

7-
class LogicException extends \RuntimeException implements ExceptionInterface
7+
class LogicException extends \LogicException implements ExceptionInterface
88
{
99
}

src/Exception/RuntimeException.php

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace XGraphQL\DelegateExecution\Exception;
6+
7+
class RuntimeException extends \RuntimeException implements ExceptionInterface
8+
{
9+
10+
}

src/RootFieldsResolver.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use GraphQL\Type\Introspection;
1818
use GraphQL\Type\Schema;
1919
use XGraphQL\DelegateExecution\Exception\LogicException;
20+
use XGraphQL\DelegateExecution\Exception\RuntimeException;
2021
use XGraphQL\Utils\SelectionSet;
2122

2223
final class RootFieldsResolver
@@ -165,7 +166,7 @@ private function accessResultByPath(array $path, ExecutionResult $result): mixed
165166
$pos = array_shift($pathAccessed);
166167

167168
if (false === array_key_exists($pos, $data)) {
168-
throw new Error(
169+
throw new RuntimeException(
169170
sprintf('Delegated execution result is missing field value at path: `%s`', implode('.', $path))
170171
);
171172
}

0 commit comments

Comments
 (0)