Fix status for non-existent JsonSchema FileGet

This will fix the incorrect status 500 to status 404 for the
non-eixstent JsonSchema FileGet.

```
% redfishtool raw GET  -r ${bmc}  -u root -p 0penBmc -S Always /redfish/v1/JsonSchemas/ComputerSystem/ComputerSystem.v1_99_1.json
   redfishtool: Transport: Response Error: status_code: 500 -- Internal Server Error
   redfishtool: raw: Error getting response
```

This commit also refactor `Response::openFile()` to return `ec` so that
the caller can check the reason of the failure.

Tested:
- Verify redfishtool result for the non-existent JsonSchema file like
```
% redfishtool raw GET  -r ${bmc}  -u root -p 0penBmc -S Always /redfish/v1/JsonSchemas/<schema>/<non-existent-schema>.json
   redfishtool: Transport: Response Error: status_code: 404 -- Not Found
   redfishtool: raw: Error getting response
```
- Redfish Service validator passes

Change-Id: I98927c076bb6e7dfb3742183b4b3545e328d2657
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
diff --git a/http/http_response.hpp b/http/http_response.hpp
index a4c8375..c411f88 100644
--- a/http/http_response.hpp
+++ b/http/http_response.hpp
@@ -21,6 +21,13 @@
 
 namespace http = boost::beast::http;
 
+enum class OpenCode
+{
+    Success,
+    FileDoesNotExist,
+    InternalError,
+};
+
 struct Response
 {
     template <typename Adaptor, typename Handler>
@@ -288,18 +295,23 @@
         expectedHash = hash;
     }
 
-    bool openFile(const std::filesystem::path& path,
-                  bmcweb::EncodingType enc = bmcweb::EncodingType::Raw)
+    OpenCode openFile(const std::filesystem::path& path,
+                      bmcweb::EncodingType enc = bmcweb::EncodingType::Raw)
     {
         boost::beast::error_code ec;
         response.body().open(path.c_str(), boost::beast::file_mode::read, ec);
         response.body().encodingType = enc;
         if (ec)
         {
-            BMCWEB_LOG_ERROR("Failed to open file {}", path.c_str());
-            return false;
+            BMCWEB_LOG_ERROR("Failed to open file {}, ec={}", path.c_str(),
+                             ec.value());
+            if (ec.value() == boost::system::errc::no_such_file_or_directory)
+            {
+                return OpenCode::FileDoesNotExist;
+            }
+            return OpenCode::InternalError;
         }
-        return true;
+        return OpenCode::Success;
     }
 
     bool openFd(int fd, bmcweb::EncodingType enc = bmcweb::EncodingType::Raw)