2024-11-22 23:01:05 -05:00
|
|
|
|
|
|
|
|
#include "BlueprintErrors.h"
|
2025-08-27 20:57:12 -04:00
|
|
|
#include "Blueprint/BlueprintExceptionInfo.h"
|
2024-11-22 23:01:05 -05:00
|
|
|
#include "Kismet2/KismetDebugUtilities.h"
|
|
|
|
|
|
|
|
|
|
ELogVerbosity::Type UlxBlueprintErrorLibrary::ConvertElxLogVerbosity(ElxLogVerbosity Verbosity) {
|
|
|
|
|
switch (Verbosity) {
|
2026-02-14 00:24:52 -05:00
|
|
|
case ElxLogVerbosity::Error: return ELogVerbosity::Error;
|
|
|
|
|
case ElxLogVerbosity::Warning: return ELogVerbosity::Warning;
|
|
|
|
|
case ElxLogVerbosity::Display: return ELogVerbosity::Display;
|
|
|
|
|
case ElxLogVerbosity::Log: return ELogVerbosity::Log;
|
|
|
|
|
case ElxLogVerbosity::ThrottledDisplay: return ELogVerbosity::Display;
|
|
|
|
|
case ElxLogVerbosity::ThrottledLog: return ELogVerbosity::Log;
|
|
|
|
|
case ElxLogVerbosity::Verbose: return ELogVerbosity::Verbose;
|
|
|
|
|
case ElxLogVerbosity::VeryVerbose: return ELogVerbosity::VeryVerbose;
|
|
|
|
|
case ElxLogVerbosity::Fatal: return ELogVerbosity::Fatal;
|
2024-11-22 23:01:05 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FlxDebugBlueprintErrorsOutputDevice::FlxDebugBlueprintErrorsOutputDevice(const ElxLogVerbosity &SensitivityRef)
|
|
|
|
|
: Sensitivity(SensitivityRef)
|
|
|
|
|
{
|
|
|
|
|
GLog->AddOutputDevice(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FlxDebugBlueprintErrorsOutputDevice::~FlxDebugBlueprintErrorsOutputDevice()
|
|
|
|
|
{
|
|
|
|
|
GLog->RemoveOutputDevice(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace UBreakPoint {
|
|
|
|
|
static volatile int V;
|
|
|
|
|
FORCENOINLINE static void OnLogFatal() {
|
|
|
|
|
V = 0;
|
|
|
|
|
}
|
|
|
|
|
FORCENOINLINE static void OnLogError() {
|
|
|
|
|
V = 1;
|
|
|
|
|
OnLogFatal();
|
|
|
|
|
}
|
|
|
|
|
FORCENOINLINE static void OnLogWarning() {
|
|
|
|
|
V = 2;
|
|
|
|
|
OnLogError();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const FName LogBlueprintDebugName(TEXT("LogBlueprintDebug"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FlxDebugBlueprintErrorsOutputDevice::Serialize(const TCHAR* V, ELogVerbosity::Type Verbosity, const FName& Category)
|
|
|
|
|
{
|
|
|
|
|
// If the error isn't serious enough, do nothing.
|
|
|
|
|
//
|
|
|
|
|
if (Verbosity > UlxBlueprintErrorLibrary::ConvertElxLogVerbosity(Sensitivity))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If the Category is LogBlueprintDebug, then we're inside the debugger already.
|
|
|
|
|
//
|
|
|
|
|
if (Category == LogBlueprintDebugName)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Find out if we're running in a blueprint thread. If not, return.
|
|
|
|
|
//
|
|
|
|
|
FFrame* Frame = FFrame::GetThreadLocalTopStackFrame();
|
|
|
|
|
if (Frame == nullptr) return;
|
|
|
|
|
UObject *TopObject = Frame->Object;
|
|
|
|
|
if (TopObject == nullptr) return;
|
|
|
|
|
|
|
|
|
|
// Notify the debugger that there's been an exception.
|
|
|
|
|
//
|
|
|
|
|
FBlueprintExceptionInfo ExceptionInfo(EBlueprintExceptionType::Breakpoint, FText::FromStringView(FStringView(V)));
|
|
|
|
|
FBlueprintCoreDelegates::ThrowScriptException(TopObject, *Frame, ExceptionInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|