You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/04/07 13:31:12 UTC

[29/50] [abbrv] groovy git commit: More useful error message in NodeList.replaceNode method (closes #516)

More useful error message in NodeList.replaceNode method (closes #516)


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

Branch: refs/heads/parrot
Commit: 97a1a48258d23968ad173db7969916d3cdd7ef6a
Parents: 4432ca2
Author: Konstantin Yegupov <ky...@gmail.com>
Authored: Wed Mar 22 18:52:44 2017 +0000
Committer: John Wagenleitner <jw...@apache.org>
Committed: Sun Mar 26 11:22:15 2017 -0700

----------------------------------------------------------------------
 src/main/groovy/util/NodeList.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/97a1a482/src/main/groovy/util/NodeList.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/util/NodeList.java b/src/main/groovy/util/NodeList.java
index 1442a53..e54009c 100644
--- a/src/main/groovy/util/NodeList.java
+++ b/src/main/groovy/util/NodeList.java
@@ -187,7 +187,8 @@ public class NodeList extends ArrayList {
 
     public Node replaceNode(Closure c) {
         if (size() <= 0 || size() > 1) {
-            throw new GroovyRuntimeException("replaceNode() can only be used to replace a single node.");
+            throw new GroovyRuntimeException(
+                    "replaceNode() can only be used to replace a single node, but was applied to " + size() + " nodes");
         }
         return ((Node)get(0)).replaceNode(c);
     }