Merge branch 'v1.7' of https://github.com/metersphere/metersphere into v1.7
This commit is contained in:
commit
61992c14d5
|
@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
|
||||||
@RestControllerAdvice
|
@RestControllerAdvice
|
||||||
|
@ -30,6 +31,12 @@ public class RestControllerExceptionHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ExceptionHandler(SQLException.class)
|
||||||
|
public ResultHolder sqlExceptionHandler(HttpServletRequest request, HttpServletResponse response, MSException e) {
|
||||||
|
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||||
|
return ResultHolder.error("SQL error happened, please check logs.");
|
||||||
|
}
|
||||||
|
|
||||||
@ExceptionHandler(MSException.class)
|
@ExceptionHandler(MSException.class)
|
||||||
public ResultHolder msExceptionHandler(HttpServletRequest request, HttpServletResponse response, MSException e) {
|
public ResultHolder msExceptionHandler(HttpServletRequest request, HttpServletResponse response, MSException e) {
|
||||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||||
|
|
Loading…
Reference in New Issue