UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RuntimeErrors.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
7#include "HAL/PlatformMisc.h"
10#include "Misc/Build.h"
11#include "Misc/CoreDelegates.h"
12
13class FText;
14
15// By default we bubble up runtime errors to the editor or log under the same circumstances as we assert with check/ensure
16#if !defined(UE_RAISE_RUNTIME_ERRORS)
17#define UE_RAISE_RUNTIME_ERRORS DO_CHECK
18#endif
19
21{
32 static CORE_API void LogRuntimeIssue(ELogVerbosity::Type Verbosity, const ANSICHAR* FileName, int32 LineNumber, const FText& Message);
33
34 // The style of delegate called when a runtime issue occurs
35 DECLARE_DELEGATE_FourParams(FRuntimeErrorDelegate, ELogVerbosity::Type /*Verbosity*/, const ANSICHAR* /*File*/, int32 /*Line*/, const FText& /*Message*/);
36
37 // A delegate this is called when a runtime issue is raised
39
49 static CORE_API bool LogRuntimeIssueReturningFalse(const ANSICHAR* Expr, const ANSICHAR* File, int32 Line);
50
51private:
53};
54
55#if UE_RAISE_RUNTIME_ERRORS && !USING_CODE_ANALYSIS
56 // Raises a runtime error to the log, possibly stopping in the BP debugger, but then returning execution to the caller
57 #define LogRuntimeError(Message) FRuntimeErrors::LogRuntimeIssue(ELogVerbosity::Error, __FILE__, __LINE__, Message)
58
59 // Raises a runtime warning to the log, possibly stopping in the BP debugger, but then returning execution to the caller
60 #define LogRuntimeWarning(Message) FRuntimeErrors::LogRuntimeIssue(ELogVerbosity::Warning, __FILE__, __LINE__, Message)
61
84 #define ensureAsRuntimeWarning(InExpression) (LIKELY(!!(InExpression)) || FRuntimeErrors::LogRuntimeIssueReturningFalse(#InExpression, __FILE__, __LINE__))
85#else
86 #define LogRuntimeError(Message)
87 #define LogRuntimeWarning(Message)
88 #define ensureAsRuntimeWarning(InExpression) (!!(InExpression))
89
90#endif
91
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::ANSICHAR ANSICHAR
An ANSI character. Normally a signed type.
Definition Platform.h:1131
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Text.h:385
Type
Definition LogVerbosity.h:17
Definition RuntimeErrors.h:21
DECLARE_DELEGATE_FourParams(FRuntimeErrorDelegate, ELogVerbosity::Type, const ANSICHAR *, int32, const FText &)
static CORE_API void LogRuntimeIssue(ELogVerbosity::Type Verbosity, const ANSICHAR *FileName, int32 LineNumber, const FText &Message)
Definition RuntimeErrors.cpp:9
static CORE_API bool LogRuntimeIssueReturningFalse(const ANSICHAR *Expr, const ANSICHAR *File, int32 Line)
Definition RuntimeErrors.cpp:14
static CORE_API FRuntimeErrorDelegate OnRuntimeIssueLogged
Definition RuntimeErrors.h:38