Parcourir la source

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

apple il y a 2 jours
Parent
commit
f86375afb3
1 fichiers modifiés avec 20 ajouts et 0 suppressions
  1. 20 0
      common/commonDefine.h

+ 20 - 0
common/commonDefine.h

@@ -30,5 +30,25 @@
         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 */