Android Throwable to String Convert getExceptionMessage(Throwable e)

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

Description

get Exception Message

Declaration

public static String getExceptionMessage(Throwable e) 

Method Source Code


public class Main{
    public static final int LEN = 80;
    public static String getExceptionMessage(Throwable e) {
        String message = e.getMessage();
        if (StringUtil.isEmpty(message)) {
            message = e.getClass().getSimpleName()
                    .replaceFirst("Exception", "");
        }//from  www  .j  a v a2s.  c  o  m
        if (message.length() > LEN) {
            message = message.substring(0, LEN) + "...";
        }
        return message;
    }
    public static boolean isEmpty(String value) {
        return value == null || value.trim().length() == 0;
    }
}

Related

  1. stringify(Throwable t)
  2. getExceptionMessage(Throwable ex)
  3. exceptionToString(Throwable t)
  4. failException(String message, Throwable got)