Navigation
API > API/Runtime > API/Runtime/Core
The type of every error. Additional details are stored opaquely and can be serialized to text, logs, or compact binary for transmission over a network.
FError instances are created with a function generated by error declarations. See UE_DECLARE_ERROR.
Additional context can be added to an error as it propogates from the source of the error through the calling code with the method PushErrorContext. Errors can share the context added to them, so copying is cheap. However, each copy will accumulate future context independently. i.e. FError Err1 = ...; FError Err2 = Err1; < Err2 and Err1 have the same context Err1.PushErrorContext(...) < Err1 now has context which Err2 does not.
FErrors can be compared with == and !=, which will only compare the originating error, i.e. the module id and error code. Additional context will not change the result of the comparison.
| Name | FError |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Experimental/UnifiedError/UnifiedError.h |
| Include Path | #include "Experimental/UnifiedError/UnifiedError.h" |
Syntax
class FError
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FError
(
int32 InModuleId, |
Primary constructor. Adds a ref count to the provided error details | Experimental/UnifiedError/UnifiedError.h | |
| Experimental/UnifiedError/UnifiedError.h | |||
| Move constructor. | Experimental/UnifiedError/UnifiedError.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FError() |
Experimental/UnifiedError/UnifiedError.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ErrorCode | int32 | Error code from a UE_DECLARE_ERROR macro to identify the original error | Experimental/UnifiedError/UnifiedError.h | |
| ErrorDetails | TRefCountPtr< const IErrorDetails > | Linked list of error details. | Experimental/UnifiedError/UnifiedError.h | |
| ModuleId | int32 | Module id from UE_DECLARE_ERROR and UE_DECLARE_ERROR_MODULE macros | Experimental/UnifiedError/UnifiedError.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FText CreateErrorMessage
(
bool bAppendContext |
Format this error as localized text. | Experimental/UnifiedError/UnifiedError.h | |
bool Equals
(
int32 InModuleId, |
Comparison against ids from statically declared error. | Experimental/UnifiedError/UnifiedError.h | |
int32 GetErrorCode() |
Return the code for this error which is unique within its module | Experimental/UnifiedError/UnifiedError.h | |
FUtf8StringView GetErrorCodeString () |
Returns the name of the error as declared in UE_DECLARE_ERROR. | Experimental/UnifiedError/UnifiedError.h | |
const T * GetErrorContext () |
Returns context information previously added with PushErrorContext, or the original data the error was created with. | Experimental/UnifiedError/UnifiedError.h | |
const decltype(Declaration) ::PayloadType * GetErrorContext () |
Helper for getting context information using the name of the error as declared rather than the name of the payload struct. | Experimental/UnifiedError/UnifiedError.h | |
const decltype(Declaration) ::PayloadType * GetErrorContext () |
Experimental/UnifiedError/UnifiedError.h | ||
FText GetErrorMessage
(
bool bAppendContext |
Temporary old name of method for migration. | Experimental/UnifiedError/UnifiedError.h | |
int32 GetModuleId() |
Return the id for this module which is unique within this process | Experimental/UnifiedError/UnifiedError.h | |
FUtf8StringView GetModuleIdAndErrorCodeString () |
Returns the name of the module in which this error was declared in UE_DECLARE_ERROR and its name, joined with the namespace operator | Experimental/UnifiedError/UnifiedError.h | |
FUtf8StringView GetModuleIdString () |
Returns the name of the module in which this error was declared in UE_DECLARE_ERROR. | Experimental/UnifiedError/UnifiedError.h | |
void Invalidate() |
Invalidates this error and discards all details as if it was moved from. | Experimental/UnifiedError/UnifiedError.h | |
bool IsValid() |
Returns true if this error was correctly constructed and has not been moved from or invalidated. | Experimental/UnifiedError/UnifiedError.h | |
FError & PushErrorContext
(
T&& InErrorStruct, |
Add additional context to this error. | Experimental/UnifiedError/UnifiedError.h | |
void SerializeToCompactBinary
(
FCbWriter& InWriter, |
Writes this error to compact binary, filtering out details based on the passed in filter. | Experimental/UnifiedError/UnifiedError.h | |
| Write this error to json for analytics. The format is the same as | Experimental/UnifiedError/UnifiedError.h | ||
bool UEOpEquals
(
const FError& Other |
Comparison support via global operators for UEOpEquals. | Experimental/UnifiedError/UnifiedError.h |