groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleit...@apache.org
Subject [2/4] groovy git commit: More useful error message in DOMCategory.replaceNode method
Date Sun, 26 Mar 2017 22:52:14 GMT
More useful error message in DOMCategory.replaceNode method

Related to change in PR #516


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/1fcdb651
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/1fcdb651
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/1fcdb651

Branch: refs/heads/GROOVY_2_5_X
Commit: 1fcdb651db81db68e9ddc8c15dfb6f7a0485c6d0
Parents: 23fd6b5
Author: John Wagenleitner <jwagenleitner@apache.org>
Authored: Sun Mar 26 11:40:24 2017 -0700
Committer: John Wagenleitner <jwagenleitner@apache.org>
Committed: Sun Mar 26 15:31:01 2017 -0700

----------------------------------------------------------------------
 .../groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/1fcdb651/subprojects/groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java b/subprojects/groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java
index d2f0d6d..71fb4d3 100644
--- a/subprojects/groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java
+++ b/subprojects/groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java
@@ -355,7 +355,10 @@ public class DOMCategory {
 
     public static Node replaceNode(NodesHolder self, Closure c) {
         if (self.getLength() <= 0 || self.getLength() > 1) {
-            throw new GroovyRuntimeException("replaceNode() can only be used to replace a
single element.");
+            throw new GroovyRuntimeException(
+                    "replaceNode() can only be used to replace a single element, " +
+                    "but was applied to " + self.getLength() + " elements."
+            );
         }
         return replaceNode(self.item(0), c);
     }


Mime
View raw message