From 0b464248257315d658a7cc023afdfe1b3ff2a2d6 Mon Sep 17 00:00:00 2001 From: Laura Andelare Date: Mon, 8 Jul 2024 13:10:35 +0000 Subject: [PATCH] Demote unhandled_exception checks to checkSlow, encourage users to remove them if needed #26 --- Source/UE5Coro/Private/Generator.cpp | 6 +++++- Source/UE5Coro/Private/Promise.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/UE5Coro/Private/Generator.cpp b/Source/UE5Coro/Private/Generator.cpp index 7de780de..f4638321 100644 --- a/Source/UE5Coro/Private/Generator.cpp +++ b/Source/UE5Coro/Private/Generator.cpp @@ -36,7 +36,11 @@ using namespace UE5Coro::Private; void FGeneratorPromise::unhandled_exception() { #if PLATFORM_EXCEPTIONS_DISABLED - check(!"Exceptions are not supported"); + // Hitting this can be a result of the generator itself invoking undefined + // behavior, e.g., by using a bad pointer. + // On Windows, SEH exceptions can end up here if C++ exceptions are disabled. + // If this hinders debugging, feel free to remove it! + checkSlow(!"Unhandled exception from generator!"); #else throw; #endif diff --git a/Source/UE5Coro/Private/Promise.cpp b/Source/UE5Coro/Private/Promise.cpp index 638fc4c9..35df3858 100644 --- a/Source/UE5Coro/Private/Promise.cpp +++ b/Source/UE5Coro/Private/Promise.cpp @@ -168,7 +168,11 @@ void FPromise::AddContinuation(std::function Fn) void FPromise::unhandled_exception() { #if PLATFORM_EXCEPTIONS_DISABLED - check(!"Exceptions are not supported"); + // Hitting this can be a result of the coroutine itself invoking undefined + // behavior, e.g., by using a bad pointer. + // On Windows, SEH exceptions can end up here if C++ exceptions are disabled. + // If this hinders debugging, feel free to remove it! + checkSlow(!"Unhandled exception from coroutine!"); #else bUnhandledException = true; throw;