Browse Source

V1.2.2
1、新增了无返回值的nJsonCatch

apple 2 ngày trước cách đây
mục cha
commit
f86375afb3
1 tập tin đã thay đổi với 20 bổ sung0 xóa
  1. 20 0
      common/commonDefine.h

+ 20 - 0
common/commonDefine.h

@@ -30,5 +30,25 @@
         return false;\
         return false;\
     }
     }
 
 
+/* nJson 异常处理的宏,不带返回值 */
+#define nJsonCatchNoReturn catch(const nJson::parse_error& e)       \
+    {   \
+        SPDLOG_WARN("nJson parse failed: {}", e.what());\
+        return;\
+    }\
+    catch(const nJson::type_error& e)                       \
+    {\
+        SPDLOG_WARN("nJson type failed: {}", e.what());\
+        return;\
+    }catch (const std::exception& e)\
+    {\
+        SPDLOG_WARN("nJson std failed: {}", e.what());\
+        return;\
+    }catch(...)\
+    {\
+        SPDLOG_WARN("nJson Operated failed: unknown error");\
+        return;\
+    }
+
 
 
 #endif /* COMMONDEFINE_H */
 #endif /* COMMONDEFINE_H */