Update common error doc
Update common error doc related to D-Bus utility functions usage and
usage of redfish schema generated enumerations in implementation
Change-Id: I7284bc28af73dc0036c7a24fb6bddb4441892122
Signed-off-by: rohitpai <rohitpai77@gmail.com>
diff --git a/COMMON_ERRORS.md b/COMMON_ERRORS.md
index 2c92cec..11f751e 100644
--- a/COMMON_ERRORS.md
+++ b/COMMON_ERRORS.md
@@ -370,3 +370,48 @@
[Cpp Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f11-use-an-unnamed-lambda-if-you-need-a-simple-function-object-in-one-place-only)
for generalized guidelines on when lambdas are appropriate. The above
recommendation is aligned with the C++ Core Guidelines.
+
+## 15. Using async_method_call where there are existing helper methods
+
+```cpp
+crow::connections::systemBus->async_method_call(
+ respHandler, "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
+ "/xyz/openbmc_project/inventory", 0, interfaces);
+```
+
+It's required to use D-Bus utility functions provided in the file
+include/dbus_utility.hpp instead of invoking them directly. Using the existing
+util functions will help to reduce the compilation time, increase code reuse and
+uniformity in error handling. Below are the list of existing D-Bus utility
+functions
+
+- getProperty
+- getAllProperties
+- checkDbusPathExists
+- getSubTree
+- getSubTreePaths
+- getAssociatedSubTree
+- getAssociatedSubTreePaths
+- getAssociatedSubTreeById
+- getAssociatedSubTreePathsById
+- getDbusObject
+- getAssociationEndPoints
+- getManagedObjects
+
+## 16. Using strings for DMTF schema Enums
+
+```cpp
+sensorJson["ReadingType"] = "Frequency";
+
+```
+
+Redfish Schema Enums and types are auto generated using
+scripts/generate_schema_enums.py. The generated header files contain the redfish
+enumerations which must be used for JSON response population.
+
+```cpp
+#include "generated/enums/sensor.hpp"
+sensorJson["ReadingType"] = sensor::ReadingType::Frequency;
+```