Copilot commented on code in PR #16135:
URL: https://github.com/apache/grails-core/pull/16135#discussion_r3769571692


##########
grails-datamapping-rx/src/main/groovy/org/grails/gorm/rx/finders/FindOrCreateByFinder.groovy:
##########
@@ -58,23 +58,23 @@ class FindOrCreateByFinder extends FindByFinder {
                     }
 
                     def newInstance = invocation.javaClass.newInstance(m)
-                    if(shouldSaveOnCreate()) {
+                    if (shouldSaveOnCreate()) {
                         def saveObservable = ((RxEntity) newInstance).save()
                         saveObservable.subscribe(new Subscriber() {
-                            @Override
-                            void onCompleted() {
-                                s.onCompleted()
-                            }
+                        @Override
+                        void onCompleted() {
+                            s.onCompleted()
+                        }
 
-                            @Override
-                            void onError(Throwable e) {
-                                s.onCompleted()
-                            }
+                        @Override
+                        void onError(Throwable e) {
+                            s.onCompleted()
+                        }

Review Comment:
   onError(Throwable e) currently calls s.onCompleted(), which swallows the 
error and makes the returned Observable appear successful. This will hide 
persistence/validation errors from callers and can lead to inconsistent 
behavior.
   
   This issue also appears on line 80 of the same file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to