From 1d4298cb7a9e195e15f0eac9db90f9b0dbbe17c4 Mon Sep 17 00:00:00 2001 From: Remco Bouckaert Date: Wed, 8 Nov 2023 10:06:45 +1300 Subject: [PATCH] improve error message when forgetting @ in XML #28 --- src/beast/base/core/Input.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/beast/base/core/Input.java b/src/beast/base/core/Input.java index 2f38eb55..aed11110 100644 --- a/src/beast/base/core/Input.java +++ b/src/beast/base/core/Input.java @@ -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())) {