You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2017/03/26 19:04:12 UTC
[2/2] groovy git commit: More useful error message in
DOMCategory.replaceNode method
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/e621ca7c
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e621ca7c
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e621ca7c
Branch: refs/heads/GROOVY_2_4_X
Commit: e621ca7c41fa2ced18de0ce12013ad743185468e
Parents: 8668552
Author: John Wagenleitner <jw...@apache.org>
Authored: Sun Mar 26 11:40:24 2017 -0700
Committer: John Wagenleitner <jw...@apache.org>
Committed: Sun Mar 26 11:41:12 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/e621ca7c/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 d42aaf1..21c04b8 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);
}