Java Exception to String getExceptionMessage(Exception ex)

Here you can find the source of getExceptionMessage(Exception ex)

Description

get Exception Message

License

Open Source License

Declaration

public static String getExceptionMessage(Exception ex) 

Method Source Code


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

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

public class Main {

    public static String getExceptionMessage(Exception ex) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        ex.printStackTrace(pw);/*from ww w .ja  v a2  s .c o m*/
        return sw.toString();
    }
}

Related

  1. getErrorMessage(Process process)
  2. getException(Exception e)
  3. getExceptionDetails(Exception e)
  4. getExceptionMessage(Exception e)
  5. getExceptionMessage(Exception ex)
  6. getExceptionMsg(Exception ex)
  7. getExceptionName(IOException ex)
  8. getExceptionStackTrace(Exception exception)
  9. getExceptionStackTraceAsString(final Exception exception)