Show full exception message in error message box for managed exceptions
This commit is contained in:
@@ -251,19 +251,13 @@ void Log::Logger::Write(LogType type, const StringView& msg)
|
|||||||
OnError(type, msg);
|
OnError(type, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if need to show message box with that log message
|
// Ensure the error gets written to the disk
|
||||||
if (type == LogType::Fatal)
|
if (type == LogType::Fatal || type == LogType::Error)
|
||||||
{
|
|
||||||
Flush();
|
Flush();
|
||||||
|
|
||||||
// Process message further
|
// Check if need to show message box with that log message
|
||||||
if (type == LogType::Fatal)
|
if (type == LogType::Fatal)
|
||||||
Platform::Fatal(msg);
|
Platform::Fatal(msg);
|
||||||
else if (type == LogType::Error)
|
|
||||||
Platform::Error(msg);
|
|
||||||
else
|
|
||||||
Platform::Info(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Char* ToString(LogType e)
|
const Char* ToString(LogType e)
|
||||||
|
|||||||
@@ -30,6 +30,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define CLR_EXCEPTION 0xE0434352
|
||||||
|
#define VCPP_EXCEPTION 0xE06D7363
|
||||||
|
|
||||||
const Char* WindowsPlatform::ApplicationWindowClass = TEXT("FlaxWindow");
|
const Char* WindowsPlatform::ApplicationWindowClass = TEXT("FlaxWindow");
|
||||||
void* WindowsPlatform::Instance = nullptr;
|
void* WindowsPlatform::Instance = nullptr;
|
||||||
|
|
||||||
@@ -272,6 +275,12 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
LONG CALLBACK SehExceptionHandler(EXCEPTION_POINTERS* ep)
|
LONG CALLBACK SehExceptionHandler(EXCEPTION_POINTERS* ep)
|
||||||
{
|
{
|
||||||
|
if (ep->ExceptionRecord->ExceptionCode == CLR_EXCEPTION)
|
||||||
|
{
|
||||||
|
// Pass CLR exceptions back to runtime
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
// Skip if engine already crashed
|
// Skip if engine already crashed
|
||||||
if (Globals::FatalErrorOccurred)
|
if (Globals::FatalErrorOccurred)
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
|||||||
@@ -135,8 +135,13 @@ namespace FlaxEngine
|
|||||||
{
|
{
|
||||||
if (e.ExceptionObject is Exception exception)
|
if (e.ExceptionObject is Exception exception)
|
||||||
{
|
{
|
||||||
Debug.LogError("Unhandled Exception: " + exception.Message);
|
if (e.IsTerminating && !System.Diagnostics.Debugger.IsAttached)
|
||||||
Debug.LogException(exception);
|
Platform.Fatal($"Unhandled Exception: {exception}");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError($"Unhandled Exception: {exception.Message}");
|
||||||
|
Debug.LogException(exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user