package kz.cafe.exceptions;

public class AbstractException extends Exception{

   private static final long serialVersionUID = -3540280291673499998L;

   protected String sMsg;
   protected Throwable originalException;
   protected int errorCode;





   public AbstractException(int errorCode, String sMsg){
      this.errorCode = errorCode;
      this.sMsg = sMsg;
   }





   public AbstractException(int errorCode, String sMsg, Throwable originalException){
      this.errorCode = errorCode;
      this.sMsg = sMsg;
      this.originalException = originalException;
   }





   public String getsMsg(){
      return sMsg;
   }





   public Throwable getOriginalException(){
      return originalException;
   }





   public int getErrorCode(){
      return errorCode;
   }





   
   @Override
   public String toString(){
      StringBuilder sb = new StringBuilder(); 
      
      sb.append("errorCode=" + errorCode + ", sMsg=" + sMsg);
      
      if(originalException == null) {
      }
      else{
         sb.append(", originalException=" + originalException);
      }
      
      return sb.toString(); 
   }
}
