log-services: Error return 500(internal error)

- If the server returns 500(internal error) to any of these requests,
  the security scanner logs it as an error for followup.

- Sometimes, it is not a real 500(internal error), may be is a 404
  (not found) error, and we think that the 404(not found) error is a
  benign error, and not actually a real security threat.

- We should handle the 404(not found) error correctly and return it
  where appropriate.

- Refer to: https://github.com/openbmc/bmcweb/blob/master/COMMON_ERRORS.md#11-not-responding-to-404

Tested:
curl -k -X DELETE -v https://$bmc/redfish/v1/Systems/system/LogServices/Dump/Entries/198274391874
- Before:
  {
   "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The request failed due to an internal service error.  The service is still operational.",
        "MessageArgs": [],
        "MessageId": "Base.1.8.1.InternalError",
        "MessageSeverity": "Critical",
        "Resolution": "Resubmit the request.  If the problem persists, consider resetting the service."
      }
    ],
    "code": "Base.1.8.1.InternalError",
    "message": "The request failed due to an internal service error.  The service is still operational."
   }
 }

- After:
 {
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type systemDumpEntry named 198274391874 was not found.",
        "MessageArgs": [
          "LogEntry",
          "198274391874"
        ],
        "MessageId": "Base.1.8.1.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.8.1.ResourceNotFound",
    "message": "The requested resource of type systemDumpEntry named 198274391874 was not found."
   }
 }

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I84c14f0294cf84606c9850dc4bacbda16e8cfa8e
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 4abf354..255c24e 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -662,10 +662,16 @@
                             const std::string& entryID,
                             const std::string& dumpType)
 {
-    auto respHandler = [asyncResp](const boost::system::error_code ec) {
+    auto respHandler = [asyncResp,
+                        entryID](const boost::system::error_code ec) {
         BMCWEB_LOG_DEBUG << "Dump Entry doDelete callback: Done";
         if (ec)
         {
+            if (ec.value() == EBADR)
+            {
+                messages::resourceNotFound(asyncResp->res, "LogEntry", entryID);
+                return;
+            }
             BMCWEB_LOG_ERROR << "Dump (DBus) doDelete respHandler got error "
                              << ec;
             messages::internalError(asyncResp->res);
@@ -1681,10 +1687,17 @@
         dbus::utility::escapePathForDbus(entryID);
 
         // Process response from Logging service.
-        auto respHandler = [asyncResp](const boost::system::error_code ec) {
+        auto respHandler = [asyncResp,
+                            entryID](const boost::system::error_code ec) {
             BMCWEB_LOG_DEBUG << "EventLogEntry (DBus) doDelete callback: Done";
             if (ec)
             {
+                if (ec.value() == EBADR)
+                {
+                    messages::resourceNotFound(asyncResp->res, "LogEntry",
+                                               entryID);
+                    return;
+                }
                 // TODO Handle for specific error code
                 BMCWEB_LOG_ERROR
                     << "EventLogEntry (DBus) doDelete respHandler got error "