diff --git a/prism/src/prism/PrismLangException.java b/prism/src/prism/PrismLangException.java index 5fb8d6b7..c095710d 100644 --- a/prism/src/prism/PrismLangException.java +++ b/prism/src/prism/PrismLangException.java @@ -64,8 +64,14 @@ public class PrismLangException extends PrismException { String msg = super.getMessage(); if (e == null) return msg; - String s = e.toString(); - if (s.length() < MAX_ERR_STR) { + String s = null; + try { + s = e.toString(); + } catch (Exception ex) { + // in case there is a problem converting the AST element to a string + // we ignore it + } + if (s != null && s.length() < MAX_ERR_STR) { if (e.hasPosition()) msg += " (\"" + s + "\", " + e.getBeginString() +")"; else msg += " (\"" + s + "\")"; }