Explorar el Código

添加IllegalArgumentException异常内容返回给前端

wangmh hace 7 años
padre
commit
400d38cfc1

+ 3 - 3
sso-server/src/main/java/com/uas/sso/web/advice/ExceptionHandlerAdvice.java

@@ -20,7 +20,7 @@ public class ExceptionHandlerAdvice {
 
 	/**
 	 * 处理运行时抛出异常
-	 * 
+	 *
 	 * @param ex 运行时异常
 	 * @return 键值对
 	 */
@@ -34,11 +34,11 @@ public class ExceptionHandlerAdvice {
 
 	/**
 	 * 允许用户看见的异常信息,直接传递给客户端
-	 * 
+	 *
 	 * @param ex 允许用户看见的异常信息
 	 * @return
 	 */
-	@ExceptionHandler(VisibleError.class)
+	@ExceptionHandler({VisibleError.class, IllegalArgumentException.class})
 	public ResponseEntity<ModelMap> handleVisibleError(VisibleError ex) {
 		HttpHeaders headers = new HttpHeaders();
 		headers.add("Content-Type", "application/json; charset=utf-8");