Java Throwable to String getDetails(Throwable t)

Here you can find the source of getDetails(Throwable t)

Description

Returns a detailed message of the t, including the stack trace.

License

Open Source License

Declaration

public static String getDetails(Throwable t) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    /**//from w ww. jav  a2  s. c o m
     * Returns a detailed message of the t, including the stack trace.
     */
    public static String getDetails(Throwable t) {
        assert t != null;
        StringWriter sw = new StringWriter();
        t.printStackTrace(new PrintWriter(sw));
        return t.getMessage() + "\n" + sw.toString();
    }
}

Related

  1. formatException(Throwable t)
  2. formatException(Throwable t)
  3. formatExceptionForDisplay(Exception e)
  4. formatThrowableForHtml(Throwable t)
  5. formatThrown(final Throwable thrown)
  6. getErrorInfo(Throwable error)
  7. getErrorMessage(Throwable e)
  8. getExceptionAsString(Throwable _ex)
  9. getExceptionDescription(Throwable e)