code: public static String[] getThrowableStrRep(Throwable throwable) {
          StringWriter sw = new StringWriter();
          PrintWriter pw = new PrintWriter(sw);
          throwable.printStackTrace(pw);
          pw.flush();
          LineNumberReader reader = new LineNumberReader(new StringReader(sw.toString()));
          ArrayList<String> lines = new ArrayList<>();
          try {
              String line = reader.readLine();
              while(line != null) {
                  lines.add(line);
                  line = reader.readLine();
              }
          } catch(IOException ex) {
              lines.add(ex.toString());
          }
          String[] rep = new String[lines.size()];
          lines.toArray(rep);
          return rep;
      }
docs: convert a Throwable into an array of Strings
  @param throwable
  @return string representation of the throwable