Skip to content

Commit 5c57fde

Browse files
committed
Explain wtf is happening if a tree that shouldn't cause a problem does cause a problem
1 parent 553a3f9 commit 5c57fde

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/edu/stanford/nlp/trees/GrammaticalStructure.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ public GrammaticalStructure(Tree t, Collection<GrammaticalRelation> relations,
178178
if (hf == null) {
179179
throw new AssertionError("Cannot use null HeadFinder");
180180
}
181-
root.percolateHeads(hf);
181+
try {
182+
root.percolateHeads(hf);
183+
} catch (IllegalArgumentException e) {
184+
throw new IllegalArgumentException("Cannot process tree:\n" + t, e);
185+
}
182186
if (root.value() == null) {
183187
root.setValue("ROOT"); // todo: cdm: it doesn't seem like this line should be here
184188
}

0 commit comments

Comments
 (0)