|
@@ -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";
|
|
|
+ }
|
|
|
}
|