package com.jyu.spinderx.util;

import com.jyu.spinderx.ui.base.MyApplication;

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

/**
 * 异常统一处理
 *
 * @author tarena
 */
public class ExceptionUtil {
    public static void handleException(Exception e) {
        if (MyApplication.isRelease) {
            //把异常信息变成字符串
            StringWriter stringWriter = new StringWriter();
            PrintWriter printWriter = new PrintWriter(stringWriter);
            e.printStackTrace(printWriter);
            String string = stringWriter.toString();
            //发邮件，发到服务器
        } else {
            e.printStackTrace();
        }
    }

}
