You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2026/09/30 14:47:48 UTC
(grails-core) 06/06: Document why DeleteEntityDataFetcher builds the response outside the try
This is an automated email from the ASF dual-hosted git repository.
jdaugherty pushed a commit to branch refactor/graphql-fetcher
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit b048d0a3d9d8ee3d2d3bf4aa88d9124b729fec90
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Wed Sep 30 10:46:51 2026 -0400
Document why DeleteEntityDataFetcher builds the response outside the try
A response handler failure on the success path must surface as a GraphQL
error rather than be reported as a failed delete, because by that point
the instance has already been removed.
---
.../grails/gorm/graphql/fetcher/impl/DeleteEntityDataFetcher.groovy | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/grails-data-graphql/core/src/main/groovy/org/grails/gorm/graphql/fetcher/impl/DeleteEntityDataFetcher.groovy b/grails-data-graphql/core/src/main/groovy/org/grails/gorm/graphql/fetcher/impl/DeleteEntityDataFetcher.groovy
index 6f04f74560..bacc5a3d37 100644
--- a/grails-data-graphql/core/src/main/groovy/org/grails/gorm/graphql/fetcher/impl/DeleteEntityDataFetcher.groovy
+++ b/grails-data-graphql/core/src/main/groovy/org/grails/gorm/graphql/fetcher/impl/DeleteEntityDataFetcher.groovy
@@ -53,6 +53,10 @@ class DeleteEntityDataFetcher<T> extends DefaultGormDataFetcher<T> implements De
@Override
T get(DataFetchingEnvironment environment) {
+ // Only the delete runs inside the try. The response is built afterwards so that a
+ // failure in the (user-replaceable) response handler propagates as a GraphQL error
+ // instead of being caught and reported to the client as a failed delete when the
+ // row has in fact already been removed.
boolean success = false
Exception exception
try {