Java Throwable to String getErrorMessage(Throwable e)

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

Description

get Error Message

License

Open Source License

Declaration

public static String getErrorMessage(Throwable e) 

Method Source Code


//package com.java2s;
import java.io.*;

public class Main {
    public static String getErrorMessage(Throwable e) {
        Writer writer = new StringWriter();
        PrintWriter pWriter = new PrintWriter(writer);
        e.printStackTrace(pWriter);//from  w w w  .  j ava  2 s  .c o m
        return writer.toString();
    }
}

Related

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