ErrorCodeException.java 1.23 KB
package com.wondertek.exception;

/**
 * 含错误码的异常类
 * 
 * @author:
 * @modify author:修改人 Modify on 修改时间
 */
public class ErrorCodeException extends RuntimeException {

    private static final long serialVersionUID = -6862869612441955620L;

    /** 错误码 */
    private String errorCode;

    /** 异常结果返回 */
    private Object result;

    public ErrorCodeException(String errorCode) {
        this(errorCode, null, null);
    }

    public ErrorCodeException(String errorCode, String message) {
        this(errorCode, message, null);
    }

    public ErrorCodeException(String errorCode, Throwable cause) {
        this(errorCode, null, cause);
    }

    public ErrorCodeException(String errorCode, String message, Throwable cause) {
        super(message, cause);
        this.errorCode = errorCode;
    }

    public ErrorCodeException(String errorCode, String message, Object result) {
        super(message);
        this.errorCode = errorCode;
        this.result = result;
    }

    public String getErrorCode() {
        return errorCode;
    }

    @Override
    public String getMessage() {
        return super.getMessage();
    }

    public Object getResult() {
        return this.result;
    }
}