I have a design question, not a jira issue, so I'm asking as a normal email

1. Why do exceptions tend to stringify nested exceptions

public InconsistentFSStateException(File dir, String descr, Throwable ex) {
    this(dir, descr + "\n" + StringUtils.stringifyException(ex));
  }

rather than retain the existing stack trace as a separate exception?

public InconsistentFSStateException(File dir, String descr, Throwable ex) {
    this(dir, descr + "\n" + StringUtils.stringifyException(ex));
    initCause(ex);
  }

2. why do exceptions tend to get stringified before logging, instead of leaving the logging framework to handle it (e.g here in DataNode)

LOG.error(dnRegistration + ":DataXceiver: " + StringUtils.stringifyException(t));

rather than

LOG.error(dnRegistration + ":DataXceiver: "+t.getMessage(),t);

I ask as I do personally like to keep all those many stack traces around in a machine readable format right up into the XML test reports, and both actions run a risk of converting them to text too early. Is this all a deliberate decision, or just a accidental policy that can be changed if someone is prepared to go through the code and make the changes?

-steve

Reply via email to