Skip to content

Commit

Permalink
improve error message when forgetting @ in XML CompEvol#28
Browse files Browse the repository at this point in the history
  • Loading branch information
rbouckaert committed Nov 7, 2023
1 parent dc30e40 commit 1d4298c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/beast/base/core/Input.java
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,10 @@ public void setValue(final Object value, final BEASTInterface beastObject) {
try {
setStringValue((String) value, beastObject);
} catch (Exception e) {
// e.printStackTrace();
Log.warning.println("Failed to set the string value to '" + value + "' for beastobject id=" + beastObject.getID());
throw new RuntimeException("Failed to set the string value to '" + value + "' for beastobject id=" + beastObject.getID());
String msg = "Failed to set the string value to '" + value + "' for beastobject id=" + beastObject.getID() +
(BEASTInterface.class.isAssignableFrom(theClass)? "\nPerhaps forgot to add a `@` in the attribute value?" : "");
Log.warning(msg);
throw new RuntimeException(msg);
}
} else if (this.value != null && this.value instanceof List<?>) {
if (theClass.isAssignableFrom(value.getClass())) {
Expand Down

0 comments on commit 1d4298c

Please sign in to comment.