Java Throwable to String getExceptionStack(Throwable e)

Here you can find the source of getExceptionStack(Throwable e)

Description

get Exception Stack

License

Apache License

Declaration

public static String getExceptionStack(Throwable e) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.PrintWriter;
import java.io.StringWriter;

public class Main {
    public static String getExceptionStack(Throwable e) {
        String msg = e.getMessage();
        try {/*from   ww w . jav  a  2s .  c  om*/
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            msg = sw.toString();
        } catch (Throwable e2) {
            msg = "bad getErrorInfoFromException";
        }

        return msg;
    }
}

Related

  1. getExceptionDetails (final Throwable e)
  2. getExceptionDetails(Throwable throwable)
  3. getExceptionHeadline(Throwable t)
  4. getExceptionPrintout(Throwable aThrowable)
  5. getExceptionStack(final Throwable e)
  6. getExceptionStackTrace(Throwable ex)
  7. getExceptionStackTrace(Throwable exception)
  8. getExceptionStackTrace(Throwable exception)
  9. getExceptionString(Throwable e)