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; } }
时间: 2024-10-13 11:14:12