From d20dbd1d8f1793b76a4eff2fb3f95dcbe1a53e2f Mon Sep 17 00:00:00 2001 From: Vasyl Skorych Date: Tue, 9 Jul 2024 13:19:11 +0200 Subject: [PATCH] fix: Exception handling in GUI main --- DyssolMainWindow/main.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/DyssolMainWindow/main.cpp b/DyssolMainWindow/main.cpp index f4b0cc68..0c0df4c1 100644 --- a/DyssolMainWindow/main.cpp +++ b/DyssolMainWindow/main.cpp @@ -3,15 +3,12 @@ * All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */ #include "Dyssol.h" -#include "FileSystem.h" -#ifdef _WIN32 +#ifdef _MSC_VER // Print message to the VS Output window. -void VSDebugOutput(const std::string_view _message) +void VSDebugOutput(const std::string& _message) { - std::ostringstream os; - os << _message; - OutputDebugStringA(os.str().c_str()); + OutputDebugStringA(_message.c_str()); } #endif @@ -26,7 +23,7 @@ void HandleException(const std::exception_ptr& _exceptionPtr) { const std::string message = "Unknown unhandled exception caught: '" + std::string{ e.what() } + "'\n"; std::cout << message; -#ifdef _WIN32 +#ifdef _MSC_VER VSDebugOutput(message); #endif }