package com.jtgh.yjpt.common; /** * 业务系统的异常类,主要用于封装业务逻辑错,给客户端提示 同时还可以封装系统错 */ public class SysException extends RuntimeException { private static final long serialVersionUID = -9013803276532569636L; /** * 警告,此时系统不记日志 */ public static final int INFTYPE_WARNING = 1; /** * 错误,此时系统记日志 */ public static final int INFTYPE_ERROR = 2; /** * 信息类型: 1警告 2错误 */ private int infType = INFTYPE_WARNING; private boolean showDetial = false; public SysException() { super(); } public SysException(String message) { super(message); this.setInfType(INFTYPE_WARNING); } public SysException(Throwable cause) { super(cause); this.setInfType(INFTYPE_ERROR); } public SysException(String message, Throwable cause) { super(message, cause); this.setInfType(INFTYPE_ERROR); } public SysException(String message, int infType) { this(message); this.setInfType(infType); } public SysException(Throwable cause, int infType) { super(cause); this.setInfType(infType); } public SysException(String message, Throwable cause, int infType) { super(message, cause); this.setInfType(infType); } public int getInfType() { return infType; } public void setInfType(int infType) { this.infType = infType; } public boolean isShowDetial() { return showDetial; } public SysException setShowDetial(boolean showdetial) { this.showDetial = showdetial; return this; } }