Sfoglia il codice sorgente

修改异常处理

tianboguang 3 anni fa
parent
commit
1f1059ed3a

+ 0 - 9
platform-common/src/main/java/com/platform/exception/GlobalExceptionHandler.java

@@ -8,7 +8,6 @@ package com.platform.exception;
 
 
 import com.platform.entity.Result;
-import com.platform.utils.R;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.http.HttpStatus;
 import org.springframework.util.StringUtils;
@@ -35,12 +34,4 @@ public class GlobalExceptionHandler {
         return Result.failure(StringUtils.isEmpty(e.getCode()) ? Result.CODE_FAILURE : e.getCode(), e.getMsg());
     }
 
-    @ResponseBody
-    @ExceptionHandler(RuntimeException.class)
-    @ResponseStatus(HttpStatus.OK)
-    public R runtimeExceptionHandler(HttpServletRequest request, RuntimeException e) {
-        log.error(request.getRequestURI() + ":" + e.getMessage());
-        return R.error(e.getMessage());
-    }
-
 }

+ 1 - 1
platform-shop/src/main/java/com/platform/service/impl/BrandServiceImpl.java

@@ -144,7 +144,7 @@ public class BrandServiceImpl implements BrandService {
     public int save(BrandEntity brand) {
         BrandEntity brandEntity = brandDao.findByName(brand.getName());
         if(brandEntity != null){
-            throw new RuntimeException("直播间生成失败,已经存在相同名称直播间");
+            throw new ApiRRException("直播间生成失败,已经存在相同名称直播间");
         }
         return brandDao.save(brand);
     }