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/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 512c24e..fc074d6 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -2620,7 +2620,8 @@
for (const auto& file : files)
{
- if (!asyncResp->res.openFile(file))
+ if (asyncResp->res.openFile(file) !=
+ crow::OpenCode::Success)
{
continue;
}