MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Error.h File Reference
#include "CoreMinimal.h"
#include "Mcro/Error.Fwd.h"
#include "Void.h"
#include "Mcro/Types.h"
#include "Mcro/Concepts.h"
#include "Mcro/SharedObjects.h"
#include "Mcro/Observable.Fwd.h"
#include "Mcro/LibraryIncludes/Start.h"
#include "yaml-cpp/yaml.h"
#include "Mcro/LibraryIncludes/End.h"
#include <source_location>

Go to the source code of this file.

Data Structures

class  Mcro::Error::IError
 
class  Mcro::Error::FAssertion
 
class  Mcro::Error::FUnavailable
 
struct  Mcro::Error::TMaybe< T >
 

Namespaces

namespace  Mcro
 
namespace  Mcro::Error
 

Macros

#define ERROR_LOG(categoryName, verbosity, error)
 
#define ERROR_CLOG(condition, categoryName, verbosity, error)
 
#define ASSERT_RETURN(condition)
 
#define UNAVAILABLE()
 
#define PROPAGATE_FAIL_TV(type, var, expression)
 
#define PROPAGATE_FAIL_V(var, expression)
 
#define PROPAGATE_FAIL(expression)
 

Typedefs

using Mcro::Error::FCanFail = TMaybe<FVoid>
 
using Mcro::Error::FTrueOrReason = TMaybe<FVoid>
 

Functions

FORCEINLINE FCanFail Mcro::Error::Success ()
 

Detailed Description

Author
David Mórász
Date
2025

Definition in file Error.h.

Macro Definition Documentation

◆ ASSERT_RETURN

#define ASSERT_RETURN ( condition)
Value:
if (UNLIKELY(!(condition))) \
->WithLocation() \
->AsRecoverable() \
->WithCodeContext(PREPROCESSOR_TO_TEXT(condition))
#define PREPROCESSOR_TO_TEXT(x)
Definition Macros.h:17
static TSharedRef< T > Make(T *newError, Args &&... args)
Definition Error.h:136

Similar to check() macro, but return an error instead of crashing

Definition at line 606 of file Error.h.

◆ ERROR_CLOG

#define ERROR_CLOG ( condition,
categoryName,
verbosity,
error )
Value:
UE_CLOG(condition, categoryName, verbosity, TEXT("%s"), *((error) \
->WithLocation() \
->ToString() \
))

Definition at line 599 of file Error.h.

◆ ERROR_LOG

#define ERROR_LOG ( categoryName,
verbosity,
error )
Value:
UE_LOG(categoryName, verbosity, TEXT("%s"), *((error) \
->WithLocation() \
->ToString() \
))

Definition at line 593 of file Error.h.

◆ PROPAGATE_FAIL

#define PROPAGATE_FAIL ( expression)
Value:
PROPAGATE_FAIL_V(PREPROCESSOR_JOIN(tempResult, __LINE__), expression)
#define PROPAGATE_FAIL_V(var, expression)
Definition Error.h:633

If a function returns an FCanFail inside another function which may also return another error use this convenience macro to propagate the failure. This is only useful with expressions which doesn't return a value upon success.

Definition at line 639 of file Error.h.

◆ PROPAGATE_FAIL_TV

#define PROPAGATE_FAIL_TV ( type,
var,
expression )
Value:
type var = (expression); \
if (UNLIKELY(var.HasError())) return var.GetError() \
->WithLocation()

If a function returns a TMaybe<V> inside another function which may also return another error use this convenience macro to propagate the failure. Set a target variable name to store a returned value upon success. Leave type argument empty for existing variables

Definition at line 624 of file Error.h.

◆ PROPAGATE_FAIL_V

#define PROPAGATE_FAIL_V ( var,
expression )
Value:
PROPAGATE_FAIL_TV(auto, var, expression)
#define PROPAGATE_FAIL_TV(type, var, expression)
Definition Error.h:624

If a function returns a TMaybe<V> inside another function which may also return another error use this convenience macro to propagate the failure. Set a local variable to store a returned value upon success.

Definition at line 633 of file Error.h.

◆ UNAVAILABLE

#define UNAVAILABLE ( )
Value:
->WithLocation() \
->AsRecoverable()

Denote that a resource which is asked for doesn't exist

Definition at line 614 of file Error.h.