Skip to content

Commit

Permalink
Add new configuration option to set default error transformer per schema
Browse files Browse the repository at this point in the history
  • Loading branch information
johannessteu committed Dec 12, 2019
1 parent bc287d0 commit 9d41e17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Classes/Service/SchemaService.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ protected function getMergedSchemaFromConfigurations(array $configuration): Sche

$executableSchemas = [];

$transforms = [new FlowErrorTransform()];
// Determine default error transformer
if (array_key_exists('errorTransform', $configuration) && ! empty($configuration['errorTransform']) && class_exists($configuration['errorTransform'])) {
$transforms = [new $configuration['errorTransform']()];
} else {
$transforms = [new FlowErrorTransform()];
}

$options = [
'typeDefs' => [],
Expand Down
1 change: 1 addition & 0 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ t3n:
# 'logRequests': true # if enabled all requests are logged
# 'context:' 'Foo\Vendor\GraphQL\Context # optional context that overrides the global context
# 'schemaEnvelope': 'Some\Fully\Qualified\Namespace'
# 'errorTransform': t3n\GraphQL\Transform\FlowErrorTransform # optional: override the default error transformer for this schema

0 comments on commit 9d41e17

Please sign in to comment.