regulators: Remove usage of InvalidEnumString
Remove usage of the internal sdbusplus exception type InvalidEnumString.
The public base class sdbusplus::exception_t is abstract, so you cannot
throw it directly. The child class InvalidEnumString was being used in
a gtest test case to throw an sdbusplus::exception_t.
Change the test case to throw the new TestSDBusError subclass instead.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I219185fdca39b12f08bb577568af614ac99031c3
diff --git a/phosphor-regulators/test/error_logging_utils_tests.cpp b/phosphor-regulators/test/error_logging_utils_tests.cpp
index f7665c0..c12a977 100644
--- a/phosphor-regulators/test/error_logging_utils_tests.cpp
+++ b/phosphor-regulators/test/error_logging_utils_tests.cpp
@@ -22,6 +22,7 @@
#include "mock_journal.hpp"
#include "mock_services.hpp"
#include "pmbus_error.hpp"
+#include "test_sdbus_error.hpp"
#include "write_verification_error.hpp"
#include <errno.h>
@@ -299,8 +300,8 @@
std::exception_ptr eptr;
try
{
- // Throw InvalidEnumString; exception_t is a pure virtual base class
- throw sdbusplus::exception::InvalidEnumString{};
+ // Throw TestSDBusError; exception_t is a pure virtual base class
+ throw TestSDBusError{"DBusError: Invalid object path."};
}
catch (...)
{
@@ -646,8 +647,8 @@
{
try
{
- // Throw InvalidEnumString; exception_t is pure virtual class
- throw sdbusplus::exception::InvalidEnumString{};
+ // Throw TestSDBusError; exception_t is pure virtual class
+ throw TestSDBusError{"DBusError: Invalid object path."};
}
catch (...)
{