From 6bc3c43f94d2995fa754508df8c53761e0d9ac67 Mon Sep 17 00:00:00 2001 From: Robert burner Schadek Date: Fri, 15 Dec 2023 17:23:37 +0100 Subject: [PATCH] Error Propagation Fix --- source/graphql/graphql.d | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/graphql/graphql.d b/source/graphql/graphql.d index ec03bad..1efe990 100644 --- a/source/graphql/graphql.d +++ b/source/graphql/graphql.d @@ -498,6 +498,14 @@ class GraphQLD(T, QContext = DefaultContext) { this.executationTraceLog.logf("elemType %s", elemType); Json ret = returnTemplate(); ret["data"] = Json.emptyArray(); + if(Constants.errors in objectValue + && !objectValue[Constants.errors].dataIsEmpty()) + { + ret[Constants.errors] = Json.emptyArray(); + foreach(err; objectValue[Constants.errors]) { + ret[Constants.errors] ~= err; + } + } QueryArrayResolver[string]* arrayTypeResolverArray = unPacked !is null @@ -511,6 +519,7 @@ class GraphQLD(T, QContext = DefaultContext) { Json[] results = iota(items.length) .map!(it => returnTemplate()) .array; + string[] fieldsHandledByArrayResolver; if(arrayTypeResolverArray !is null) { FieldRange fr = fieldRange(ss, doc