Forráskód Böngészése

Merge branch 'feature-domain-implement' of ssh://git.mooctest.com:1022/crowd-2019/crowd-test-service-backend into feature-domain-implement

commit
guochao 6 éve
szülő
commit
ec1f9b7696

+ 1 - 1
core/src/main/java/com/mooctest/crowd/domain/exception/BaseException.java

@@ -8,7 +8,7 @@ import lombok.NoArgsConstructor;
  * @date 2019-07-25 00:15
  */
 @NoArgsConstructor
-public class BaseException extends Exception {
+public class BaseException extends RuntimeException {
     public BaseException(String msg){
         super(msg);
     }

+ 9 - 0
site/src/main/java/com/mooctest/crowd/site/controller/advice/ExceptionAdvice.java

@@ -6,6 +6,7 @@ import com.mooctest.crowd.domain.exception.*;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.ResponseStatus;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 
@@ -37,4 +38,12 @@ public class ExceptionAdvice {
         } else
             return new ResponseMessage(ResponseConstant.FAIL, ResponseConstant.REQUEST_FAILED);
     }
+
+    @ExceptionHandler(Exception.class)
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    @ResponseBody
+    public String handleSystemException(Exception e){
+        log.error("System Error", e);
+        return "There is a system error";
+    }
 }