Browse Source

selectAlertrule2 异常返回优化

wanghs 2 years ago
parent
commit
4ce9139a38

+ 9 - 1
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/HomeController.java

@@ -78,7 +78,15 @@ public class HomeController {
             Map<String, Integer> alertrule2s = alertrule2Service.queryList(station, modelid);
             wrapper = ResponseWrapper.success("请求成功", alertrule2s);
         } catch (Exception ex) {
-            wrapper = ResponseWrapper.error("请求失败", JSON.toJSONString(ex.getStackTrace()));
+
+            StringBuilder exStr = new StringBuilder();
+            StackTraceElement[] trace = ex.getStackTrace();
+            for (StackTraceElement s : trace) {
+                exStr.append("\tat " + s + "\r\n");
+            }
+
+
+            wrapper = ResponseWrapper.error("请求失败", ex.toString()+"\n"+exStr);
         }
         return wrapper;