码迷,mamicode.com
首页 > 其他好文 > 详细

ext异常,ExceptionReturn

时间:2015-11-06 16:23:11      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:

package cn.edu.hbcf.common.vo;

import java.io.PrintWriter;
import java.io.StringWriter;
 
/**
 * Ext 异常返回对象
 * 
 * @author LiPenghui
 */
public class ExceptionReturn {
    /**
     * 是否成功
     */
    private boolean success;
    /**
     * 异常消息
     */
    private Object exceptionMessage;

    public ExceptionReturn() {

    }

    /**
     * 异常时的构造方法
     * 
     * @param msg
     *            异常消息
     */
    public ExceptionReturn(Throwable exceptionMessage) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        exceptionMessage.printStackTrace(pw);
        // 异常情况
        this.success = false;
        this.exceptionMessage = exceptionMessage.getMessage();
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public Object getExceptionMessage() {
        return exceptionMessage;
    }

    public void setExceptionMessage(Object exceptionMessage) {
        this.exceptionMessage = exceptionMessage;
    }
}

 

ext异常,ExceptionReturn

标签:

原文地址:http://www.cnblogs.com/zrui-xyu/p/4942834.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!