Outsourced stackTraceToString.