dig Message out of Throwable : Exception « Development « Android






dig Message out of Throwable

    
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;

class Main {

    public static String digMessage(Throwable e) {
        String msg = e.getMessage();
        if (msg == null && e.getCause() != null) {
            return digMessage(e.getCause());
        }
        return msg;
    }
}

   
    
    
    
  








Related examples in the same category

1.serialize Throwable