From ce5311ef54fc540b724152de7cf99066e0bebc82 Mon Sep 17 00:00:00 2001
From: kongr45gpen <electrovesta@gmail.com>
Date: Wed, 10 Aug 2022 18:22:17 +0300
Subject: [PATCH] Fix incorrect error reporting on enums

---
 src/Platform/x86/ErrorHandler.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/Platform/x86/ErrorHandler.cpp b/src/Platform/x86/ErrorHandler.cpp
index ffddffd2..06ad3859 100644
--- a/src/Platform/x86/ErrorHandler.cpp
+++ b/src/Platform/x86/ErrorHandler.cpp
@@ -8,6 +8,7 @@
 #include <ErrorHandler.hpp>
 #include <Message.hpp>
 #include <Logger.hpp>
+#include <type_traits>
 
 // TODO: Find a way to reduce the number of copies of this chunk
 template void ErrorHandler::logError(const Message&, ErrorHandler::AcceptanceErrorType);
@@ -26,7 +27,7 @@ void ErrorHandler::logError(const Message& message, ErrorType errorType) {
 	     */
 	    << abi::__cxa_demangle(typeid(ErrorType).name(), nullptr, nullptr, nullptr) << " Error "
 	    << "[" << static_cast<uint16_t>(message.serviceType) << "," << static_cast<uint16_t>(message.messageType)
-	    << "]: " << errorType;
+	    << "]: " << std::underlying_type_t<ErrorType>(errorType);
 }
 
 template <typename ErrorType>
@@ -36,5 +37,7 @@ void ErrorHandler::logError(ErrorType errorType) {
 	     * Gets the error class name from the template
 	     * Note: This is g++-dependent code and should only be used for debugging.
 	     */
-	    << abi::__cxa_demangle(typeid(ErrorType).name(), nullptr, nullptr, nullptr) << " Error: " << errorType;
+	    << abi::__cxa_demangle(typeid(ErrorType).name(), nullptr, nullptr, nullptr)
+	    << " Error: "
+	    << std::underlying_type_t<ErrorType>(errorType);
 }
-- 
GitLab