@Override public String toString() { if (problemNode == null && getMessage() == null) return "AstException (unknown cause)"; if (problemNode == null) return "AstException: " + getMessage(); String nodeDescription = problemNode == null ? "(null)" : (problemNode.getClass().getName() + "(toString failed)"); try { nodeDescription = problemNode.toString(); } catch (Throwable ignore) { //throwing exceptions in toString() is bad. } if (getMessage() == null) return "AstException at " + nodeDescription; return String.format("AstException: %s (at %s)", getMessage(), nodeDescription); } }
@Override public String toString() { if (problemNode == null && getMessage() == null) return "ResolutionException (unknown cause)"; if (problemNode == null) return "AstException: " + getMessage(); String nodeDescription = problemNode == null ? "(null)" : (problemNode.getClass().getName() + "(toString failed)"); try { nodeDescription = problemNode.toString(); } catch (Throwable ignore) { //throwing exceptions in toString() is bad. } if (getMessage() == null) return "ResolutionException at " + nodeDescription; return String.format("ResolutionException: %s (at %s)", getMessage(), nodeDescription); } }