ddd

来源:互联网 发布:学习编程先学什么 编辑:程序博客网 时间:2024/05/01 16:21
 
package org.exception;

/**
 * 订单管理系统的基础错误
 * 
 * 
@author rodney
 * 
 
*/

public class OrderBaseException extends RuntimeException {

    
/**
     * 
     
*/

    
private static final long serialVersionUID = -2660698259967334093L;

    
private String errorCode;

    
private String errorMessage;

    
public OrderBaseException() {
        
super();
    }


    
/**
     * 
     * 
@param msg
     * 
@param cause
     
*/

    
public OrderBaseException(String msg, Throwable cause) {
        
super(msg, cause);
    }


    
/**
     * 
     * 
@param msg
     
*/

    
public OrderBaseException(String msg) {
        
super(msg);
    }


    
/**
     * 
     * 
@param cause
     
*/

    
public OrderBaseException(Throwable cause) {
        
super(cause);
    }


    
/**
     * 封装错误信息和错误代码
     * 
     * 
@param errorCode
     * 
@param msg
     
*/

    
public OrderBaseException(String errorCode, String msg) {
        
super();
        
this.errorMessage = msg;
        
this.errorCode = errorCode;
    }


    
/**
     * 出现异常时,除了封装错误代码和错误信息外,还封装了堆栈信息
     * 
     * 
@param errorCode
     * 
@param msg
     * 
@param cause
     
*/

    
public OrderBaseException(String errorCode, String msg, Throwable cause) {
        
super(cause);
        
this.errorMessage = msg;
        
this.errorCode = errorCode;
    }


    
/**
     * 
@return 错误代码
     
*/

    
public String getErrorCode() {
        
return errorCode;
    }


    
/**
     * 
@param errorCode
     *            设置错误代码
     
*/

    
public void setErrorCode(String errorCode) {
        
this.errorCode = errorCode;
    }


    
/**
     * 
@return 自定义的错误信息
     
*/

    
public String getErrorMessage() {
        
return errorMessage;
    }


    
/**
     * 
@param errorMessage
     *            设置自定义的错误信息
     
*/

    
public void setErrorMessage(String errorMessage) {
        
this.errorMessage = errorMessage;
    }

}

 
原创粉丝点击