dbus_rest: return error response with not found when bad dbus request

Symptom:
Run automation test "Create Two User Initiated Dump And Delete One"
then we got ERROR as below.
Create Two User Initiated Dump And Delete One        | FAIL |
Test Bmc Dump :: Test dump functionality of OpenBMC. | FAIL |
**ERROR** 200 != 404

Root cause:
handleGet() function of dbus_rest in bmcweb should be return setErrorResponse()
when doing get request after delete 1 bmc dump.
After checking code flow that will print "message 200 OK",
not "message 404 Not Found".

Due to /xyz/openbmc_project/dump/bmc/entry/1 object path already be deleted and not exist.
Thus when doing get request again with the deleted object path,
we will found that async_send() call return "Bad dbus request error".
But, code flow will keep to response with [200], not [404].
Response should be [404] not [200]. That's why auto test report "**ERROR** 200 != 404".

Solution:
Add setErrorResponse with not found error message return
when async_send return "Bad dbus request error".

Tested:
robot -t Create_Two_User_Initiated_Dump_And_Delete_One redfish/extended/test_bmc_dump.robot
Create Two User Initiated Dump And Delete One        | PASS |
Test Bmc Dump :: Test dump functionality of OpenBMC. | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed

Signed-off-by: Tim Lee <timlee660101@gmail.com>
Change-Id: I81e4f22bc2a24f482a41b757835068ca81321437
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index b988095..19c462f 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -1698,34 +1698,34 @@
                             {
                                 BMCWEB_LOG_ERROR << "Bad dbus request error: "
                                                  << ec2;
+                                setErrorResponse(
+                                    asyncResp->res,
+                                    boost::beast::http::status::not_found,
+                                    notFoundDesc, notFoundMsg);
+                                return;
+                            }
+                            nlohmann::json properties;
+                            int r = convertDBusToJSON("a{sv}", msg, properties);
+                            if (r < 0)
+                            {
+                                BMCWEB_LOG_ERROR << "convertDBusToJSON failed";
                             }
                             else
                             {
-                                nlohmann::json properties;
-                                int r =
-                                    convertDBusToJSON("a{sv}", msg, properties);
-                                if (r < 0)
+                                for (auto& prop : properties.items())
                                 {
-                                    BMCWEB_LOG_ERROR
-                                        << "convertDBusToJSON failed";
-                                }
-                                else
-                                {
-                                    for (auto& prop : properties.items())
-                                    {
-                                        // if property name is empty, or
-                                        // matches our search query, add it
-                                        // to the response json
+                                    // if property name is empty, or
+                                    // matches our search query, add it
+                                    // to the response json
 
-                                        if (propertyName->empty())
-                                        {
-                                            (*response)[prop.key()] =
-                                                std::move(prop.value());
-                                        }
-                                        else if (prop.key() == *propertyName)
-                                        {
-                                            *response = std::move(prop.value());
-                                        }
+                                    if (propertyName->empty())
+                                    {
+                                        (*response)[prop.key()] =
+                                            std::move(prop.value());
+                                    }
+                                    else if (prop.key() == *propertyName)
+                                    {
+                                        *response = std::move(prop.value());
                                     }
                                 }
                             }