Skip to content

Commit 9d41e17

Browse files
committed
Add new configuration option to set default error transformer per schema
1 parent bc287d0 commit 9d41e17

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Classes/Service/SchemaService.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,12 @@ protected function getMergedSchemaFromConfigurations(array $configuration): Sche
160160

161161
$executableSchemas = [];
162162

163-
$transforms = [new FlowErrorTransform()];
163+
// Determine default error transformer
164+
if (array_key_exists('errorTransform', $configuration) && ! empty($configuration['errorTransform']) && class_exists($configuration['errorTransform'])) {
165+
$transforms = [new $configuration['errorTransform']()];
166+
} else {
167+
$transforms = [new FlowErrorTransform()];
168+
}
164169

165170
$options = [
166171
'typeDefs' => [],

Configuration/Settings.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ t3n:
2828
# 'logRequests': true # if enabled all requests are logged
2929
# 'context:' 'Foo\Vendor\GraphQL\Context # optional context that overrides the global context
3030
# 'schemaEnvelope': 'Some\Fully\Qualified\Namespace'
31+
# 'errorTransform': t3n\GraphQL\Transform\FlowErrorTransform # optional: override the default error transformer for this schema

0 commit comments

Comments
 (0)