version_handler: Read doesn't need to catch missing sessions
The read() interface from phosphor-ipmi-blobs will never call read with
an invalid session, so we don't need to catch the exception if the
session doesn't exist.
Change-Id: I2ccb351b85d18a6eb96d4f92cfb3167a95f0509e
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/bmc/version-handler/test/version_read_unittest.cpp b/bmc/version-handler/test/version_read_unittest.cpp
index e1c4618..bee3d11 100644
--- a/bmc/version-handler/test/version_read_unittest.cpp
+++ b/bmc/version-handler/test/version_read_unittest.cpp
@@ -50,11 +50,6 @@
EXPECT_EQ(h->read(defaultSessionNumber, 2, 10), vector1);
}
-TEST_F(VersionReadBlobTest, VerifyUnopenedReadFails)
-{
- EXPECT_THAT(h->read(defaultSessionNumber, 0, 10), IsEmpty());
-}
-
TEST_F(VersionReadBlobTest, VerifyTriggerFailureReadFails)
{
EXPECT_CALL(*tm.at("blob0"), trigger()).WillOnce(Return(true));
diff --git a/bmc/version-handler/version_handler.cpp b/bmc/version-handler/version_handler.cpp
index fee62d9..a5a357b 100644
--- a/bmc/version-handler/version_handler.cpp
+++ b/bmc/version-handler/version_handler.cpp
@@ -1,6 +1,5 @@
#include "version_handler.hpp"
-#include <stdexcept>
#include <utility>
#include <vector>
@@ -90,15 +89,8 @@
std::vector<uint8_t> VersionBlobHandler::read(uint16_t session, uint32_t offset,
uint32_t requestedSize)
{
- BlobInfo* pack;
- try
- {
- pack = sessionToBlob.at(session);
- }
- catch (const std::out_of_range& e)
- {
- return {};
- }
+ auto pack = sessionToBlob.at(session);
+
/* onOpen trigger must be successful, otherwise potential
* for stale data to be read
*/