| package com.xzx.gc.common.utils;  | 
|   | 
| import com.xzx.gc.common.exception.BusinessException;  | 
| import com.xzx.gc.common.exception.PlatformException;  | 
| import com.xzx.gc.common.exception.RestException;  | 
| import lombok.experimental.UtilityClass;  | 
| import lombok.extern.slf4j.Slf4j;  | 
|   | 
| @Slf4j  | 
| @UtilityClass  | 
| public class ExceptionUtils {  | 
|   | 
|     public void err(Integer code,String msg,Exception e){  | 
|         error(code,msg,e);  | 
|   | 
|     }  | 
|   | 
|     public void err(String msg,Exception e){  | 
|         error(-1,msg,e);  | 
|     }  | 
|   | 
|     private void error(Integer code,String msg,Exception e){  | 
|         if(e instanceof RestException||e instanceof BusinessException){  | 
|             throw  new BusinessException(code,msg,msg);  | 
|         }else {  | 
|             throw  new PlatformException(msg,e);  | 
|         }  | 
|     }  | 
|   | 
| }  |