wangwei 5 жил өмнө
parent
commit
7414cd5026

+ 5 - 1
src/main/java/cn/com/qmth/examcloud/ws/starter/core/WebSocketServerEndpoint.java

@@ -228,7 +228,11 @@ public class WebSocketServerEndpoint {
 			for (int i = 0; i < parameterTypes.length; i++) {
 				Class<?> curType = parameterTypes[i];
 				if (hasMessageParam && i == messageParamIndex) {
-					args[i] = JsonUtil.fromJson(message, curType);
+					try {
+						args[i] = JsonUtil.fromJson(message, curType);
+					} catch (Exception e) {
+						throw new StatusException("508", "fail to parse message.");
+					}
 					continue;
 				}
 				if (curType.equals(User.class)) {