Java Throwable to String getErrorInfo(Throwable error)

Here you can find the source of getErrorInfo(Throwable error)

Description

get Error Info

License

Apache License

Declaration

public static String getErrorInfo(Throwable error) 

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 getErrorInfo(Throwable error) {
        try {/*  ww w. j  av a 2  s  . c o m*/
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            error.printStackTrace(pw);
            return sw.toString();
        } catch (Exception e1) {
            return "";
        }
    }
}

Related

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