1
0

2 Commits 4bc45478c1 ... a8168bb492

Autor SHA1 Mensagem Data
  Apple a8168bb492 V0.11.6 4 dias atrás
  Apple 83a6e9b7c6 V0.11.5 4 dias atrás
2 arquivos alterados com 20 adições e 0 exclusões
  1. 19 0
      common/commonDefine.h
  2. 1 0
      common/communication/WebAPIBase.h

+ 19 - 0
common/commonDefine.h

@@ -10,6 +10,25 @@
 
 #define nJson nlohmann::json
 
+/* nJson 异常处理的宏 */
+#define nJsonCatch catch(const nJson::parse_error& e)       \
+    {   \
+        SPDLOG_WARN("nJson parse failed: {}", e.what());\
+        return false;\
+    }\
+    catch(const nJson::type_error& e)                       \
+    {\
+        SPDLOG_WARN("nJson type failed: " << e.what());\
+        return false;\
+    }catch (const std::exception& e)\
+    {\
+        SPDLOG_WARN("nJson std failed: " << e.what());\
+        return false;\
+    }catch(...)\
+    {\
+        SPDLOG_WARN("nJson Operated failed: unknown error");\
+        return false;\
+    }
 
 
 #endif /* COMMONDEFINE_H */

+ 1 - 0
common/communication/WebAPIBase.h

@@ -7,6 +7,7 @@
 
 class lhhttpapi;
 
+
 class WebAPIBase
 {
 public: