Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing ClientAware on exceptions #530

Merged
merged 7 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

### Checklist
- [ ] Existing tests have been adapted and/or new tests have been added
- [ ] Code style has been fixed via `composer fix-tyle`
- [ ] Code style has been fixed via `composer fix-style`
12 changes: 11 additions & 1 deletion src/Error/AuthorizationError.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@

namespace Rebing\GraphQL\Error;

use GraphQL\Error\ClientAware;
use GraphQL\Error\Error;

class AuthorizationError extends Error
class AuthorizationError extends Error implements ClientAware
{
public function isClientSafe(): bool
{
return true;
}

public function getCategory(): string
{
return 'authorization';
}
}
13 changes: 12 additions & 1 deletion src/Error/ValidationError.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

namespace Rebing\GraphQL\Error;

use GraphQL\Error\ClientAware;
use GraphQL\Error\Error;
use Illuminate\Contracts\Support\MessageBag;
use Illuminate\Contracts\Validation\Validator;

class ValidationError extends Error
class ValidationError extends Error implements ClientAware
{
/** @var Validator */
private $validator;
Expand All @@ -29,4 +30,14 @@ public function getValidator(): Validator
{
return $this->validator;
}

public function isClientSafe(): bool
{
return true;
}

public function getCategory(): string
{
return 'validation';
}
}