Skip to content

Commit 34857fc

Browse files
committed
Prepare v6.49.0
1 parent cc4b1d1 commit 34857fc

32 files changed

+75
-133
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ You can find and compare releases at the [GitHub release page](https://github.co
99

1010
## Unreleased
1111

12+
## v6.49.0
13+
1214
### Added
1315

1416
- Make reporting of client-safe errors configurable https://github.com/nuwave/lighthouse/issues/2647

docs/master/digging-deeper/error-handling.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ Client-safe errors are assumed to be something that:
2828

2929
Thus, they are typically not actionable for server developers.
3030

31-
However, as Laravel allows to define a [minimum log level](https://laravel.com/docs/errors#exception-log-levels)
32-
at which each individual log channel is triggered, you can choose to report client-safe errors by replacing
33-
`Nuwave\Lighthouse\Execution\ReportingErrorHandler` with `Nuwave\Lighthouse\Execution\AlwaysReportingErrorHandler`
34-
in the `lighthouse.php` config:
31+
However, you can choose to report client-safe errors by replacing `Nuwave\Lighthouse\Execution\ReportingErrorHandler`
32+
with `Nuwave\Lighthouse\Execution\AlwaysReportingErrorHandler` in the `lighthouse.php` config:
3533

3634
```diff
3735
'error_handlers' => [
@@ -40,8 +38,7 @@ in the `lighthouse.php` config:
4038
],
4139
```
4240

43-
When using `Nuwave\Lighthouse\Execution\AlwaysReportingErrorHandler`, client-safe exceptions will be passed to the
44-
default Laravel exception handler, allowing you to configure appropriate error reporting outside of Lighthouse.
41+
`Nuwave\Lighthouse\Execution\AlwaysReportingErrorHandler` reports all errors through the default Laravel exception handler, regardless of client-safety.
4542

4643
## Additional Error Information
4744

src/Bind/BindDefinition.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ public function validate(
2828
$parentNodeName = $parentNode->name->value;
2929

3030
if (! class_exists($this->class)) {
31-
throw new DefinitionException(
32-
"@bind argument `class` defined on `{$parentNodeName}.{$nodeName}` must be an existing class, received `{$this->class}`.",
33-
);
31+
throw new DefinitionException("@bind argument `class` defined on `{$parentNodeName}.{$nodeName}` must be an existing class, received `{$this->class}`.");
3432
}
3533

3634
if ($this->isModelBinding()) {
@@ -42,9 +40,7 @@ public function validate(
4240
}
4341

4442
$modelClass = Model::class;
45-
throw new DefinitionException(
46-
"@bind argument `class` defined on `{$parentNodeName}.{$nodeName}` must extend {$modelClass} or define the method `__invoke`, but `{$this->class}` does neither.",
47-
);
43+
throw new DefinitionException("@bind argument `class` defined on `{$parentNodeName}.{$nodeName}` must extend {$modelClass} or define the method `__invoke`, but `{$this->class}` does neither.");
4844
}
4945

5046
public function isModelBinding(): bool

src/Events/StartExecution.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,20 @@ public function __construct(
2222
* The parsed schema.
2323
*/
2424
public Schema $schema,
25-
2625
/**
2726
* The client given parsed query string.
2827
*/
2928
public DocumentNode $query,
30-
3129
/**
3230
* The client given variables, neither validated nor transformed.
3331
*
3432
* @var array<string, mixed>|null
3533
*/
3634
public ?array $variables,
37-
3835
/**
3936
* The client given operation name.
4037
*/
4138
public ?string $operationName,
42-
4339
/**
4440
* The context for the operation.
4541
*/

src/Execution/AlwaysReportingErrorHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use GraphQL\Error\Error;
66
use Illuminate\Contracts\Debug\ExceptionHandler;
77

8+
/** Report all errors through the default Laravel exception handler. */
89
class AlwaysReportingErrorHandler implements ErrorHandler
910
{
1011
public function __construct(

src/GraphQL.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -315,31 +315,15 @@ public function loadPersistedQuery(string $sha256hash): DocumentNode
315315
|| ! ($cacheConfig['enable'] ?? false)
316316
) {
317317
// https://github.com/apollographql/apollo-server/blob/37a5c862261806817a1d71852c4e1d9cdb59eab2/packages/apollo-server-errors/src/index.ts#L240-L248
318-
throw new Error(
319-
'PersistedQueryNotSupported',
320-
null,
321-
null,
322-
[],
323-
null,
324-
null,
325-
['code' => 'PERSISTED_QUERY_NOT_SUPPORTED'],
326-
);
318+
throw new Error('PersistedQueryNotSupported', null, null, [], null, null, ['code' => 'PERSISTED_QUERY_NOT_SUPPORTED']);
327319
}
328320

329321
$cacheFactory = Container::getInstance()->make(CacheFactory::class);
330322
$store = $cacheFactory->store($cacheConfig['store']);
331323

332324
return $store->get("lighthouse:query:{$sha256hash}")
333325
// https://github.com/apollographql/apollo-server/blob/37a5c862261806817a1d71852c4e1d9cdb59eab2/packages/apollo-server-errors/src/index.ts#L230-L239
334-
?? throw new Error(
335-
'PersistedQueryNotFound',
336-
null,
337-
null,
338-
[],
339-
null,
340-
null,
341-
['code' => 'PERSISTED_QUERY_NOT_FOUND'],
342-
);
326+
?? throw new Error('PersistedQueryNotFound', null, null, [], null, null, ['code' => 'PERSISTED_QUERY_NOT_FOUND']);
343327
}
344328

345329
/** @return ErrorsHandler */

src/Pagination/PaginationArgs.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,15 @@ public static function extractArgs(array $args, ResolveInfo $resolveInfo, Pagina
3939
: Arr::get($args, 'page', 1);
4040

4141
if ($first < 0) {
42-
throw new Error(
43-
self::requestedLessThanZeroItems($first),
44-
);
42+
throw new Error(self::requestedLessThanZeroItems($first));
4543
}
4644

4745
// Make sure the maximum pagination count is not exceeded
4846
if (
4947
$paginateMaxCount !== null
5048
&& $first > $paginateMaxCount
5149
) {
52-
throw new Error(
53-
self::requestedTooManyItems($paginateMaxCount, $first),
54-
);
50+
throw new Error(self::requestedTooManyItems($paginateMaxCount, $first));
5551
}
5652

5753
$optimalPaginationType = self::optimalPaginationType($proposedPaginationType, $resolveInfo);

src/Schema/AST/ASTBuilder.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ protected function extendObjectLikeType(string $typeName, ObjectTypeExtensionNod
144144
$extendedObjectLikeType = Parser::objectTypeDefinition(/** @lang GraphQL */ "type {$typeName}");
145145
$this->documentAST->setTypeDefinition($extendedObjectLikeType);
146146
} else {
147-
throw new DefinitionException(
148-
$this->missingBaseDefinition($typeName, $typeExtension),
149-
);
147+
throw new DefinitionException($this->missingBaseDefinition($typeName, $typeExtension));
150148
}
151149
}
152150

src/Schema/AST/ASTHelper.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ public static function mergeUniqueNodeList(NodeList|array $original, NodeList|ar
7171
$oldName = $definition->name->value;
7272
$collisionOccurred = in_array($oldName, $newNames);
7373
if ($collisionOccurred && ! $overwriteDuplicates) {
74-
throw new DefinitionException(
75-
static::duplicateDefinition($oldName),
76-
);
74+
throw new DefinitionException(static::duplicateDefinition($oldName));
7775
}
7876

7977
return $collisionOccurred;
@@ -342,11 +340,7 @@ public static function extractDirectiveDefinition(string $definitionString): Dir
342340
try {
343341
$document = Parser::parse($definitionString);
344342
} catch (SyntaxError $syntaxError) {
345-
throw new DefinitionException(
346-
"Encountered syntax error while parsing this directive definition:\n\n{$definitionString}",
347-
$syntaxError->getCode(),
348-
$syntaxError,
349-
);
343+
throw new DefinitionException("Encountered syntax error while parsing this directive definition:\n\n{$definitionString}", $syntaxError->getCode(), $syntaxError);
350344
}
351345

352346
/** @var \GraphQL\Language\AST\DirectiveDefinitionNode|null $directive */

src/Schema/DirectiveLocator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ public function namespaces(): array
6363
// Built-in and plugin defined directives come next
6464
$this->eventsDispatcher->dispatch(new RegisterDirectiveNamespaces()),
6565
]))
66-
->flatten()
67-
->filter()
68-
// Ensure built-in directives come last
69-
->sortBy(static fn (string $namespace): int => (int) str_starts_with($namespace, 'Nuwave\\Lighthouse'))
70-
->all();
66+
->flatten()
67+
->filter()
68+
// Ensure built-in directives come last
69+
->sortBy(static fn (string $namespace): int => (int) str_starts_with($namespace, 'Nuwave\\Lighthouse'))
70+
->all();
7171
}
7272

7373
/**

0 commit comments

Comments
 (0)