Skip to content

Commit

Permalink
Improve docs on error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Dec 4, 2024
1 parent 104d2a2 commit 3524160
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
15 changes: 13 additions & 2 deletions docs/6/digging-deeper/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ be implemented by Exceptions to control how they are rendered to the client.

Head over their [Error Handling docs](https://webonyx.github.io/graphql-php/error-handling) to learn more.

## Error Reporting

Lighthouse will catch exceptions thrown during the execution of a query and return them as part of the response.

The error handler `Nuwave\Lighthouse\Execution\ReportingErrorHandler` is included in the default configuration
and reports non-client-safe errors through the default Laravel exception handler.

Client-safe errors are assumed to be something that:
- a client can understand and handle
- were caused by client misuse, e.g. wrong syntax, authentication, validation
Thus, they are typically not actionable for server developers.

## Additional Error Information

The interface [`GraphQL\Error\ProvidesExtensions`](https://github.com/webonyx/graphql-php/blob/master/src/Error/ProvidesExtensions.php)
Expand Down Expand Up @@ -116,8 +128,7 @@ Add them to your `lighthouse.php` config file, for example:
```php
'error_handlers' => [
\App\GraphQL\CountErrorHandler::class,
\Nuwave\Lighthouse\Execution\ValidationErrorHandler::class,
\Nuwave\Lighthouse\Execution\ReportingErrorHandler::class,
...
],
```

Expand Down
15 changes: 13 additions & 2 deletions docs/master/digging-deeper/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ be implemented by Exceptions to control how they are rendered to the client.

Head over their [Error Handling docs](https://webonyx.github.io/graphql-php/error-handling) to learn more.

## Error Reporting

Lighthouse will catch exceptions thrown during the execution of a query and return them as part of the response.

The error handler `Nuwave\Lighthouse\Execution\ReportingErrorHandler` is included in the default configuration
and reports non-client-safe errors through the default Laravel exception handler.

Client-safe errors are assumed to be something that:
- a client can understand and handle
- were caused by client misuse, e.g. wrong syntax, authentication, validation
Thus, they are typically not actionable for server developers.

## Additional Error Information

The interface [`GraphQL\Error\ProvidesExtensions`](https://github.com/webonyx/graphql-php/blob/master/src/Error/ProvidesExtensions.php)
Expand Down Expand Up @@ -116,8 +128,7 @@ Add them to your `lighthouse.php` config file, for example:
```php
'error_handlers' => [
\App\GraphQL\CountErrorHandler::class,
\Nuwave\Lighthouse\Execution\ValidationErrorHandler::class,
\Nuwave\Lighthouse\Execution\ReportingErrorHandler::class,
...
],
```

Expand Down

0 comments on commit 3524160

Please sign in to comment.