MCRO
C++23 utilities for Unreal Engine.
|
#include "CoreMinimal.h"
#include "Mcro/Error.h"
#include "Mcro/Macros.h"
#include "Logging/LogMacros.h"
Go to the source code of this file.
Namespaces | |
namespace | Mcro |
namespace | Mcro::AssertMacros |
namespace | Mcro::AssertMacros::Detail |
Macros | |
#define | PROPAGATE_FAIL(expression) |
#define | MCRO_ASSERT_SUBMIT_ERROR(condition, severity, async, important, ...) |
#define | MCRO_ASSERT_CRASH_METHOD |
#define | MCRO_CRASH_BODY(condition, ...) |
#define | MCRO_QUIT_BODY(condition, returnOnFailure, ...) |
#define | MCRO_ASSERT_CRASH_COMMON(condition, ...) |
#define | MCRO_ASSERT_QUIT_COMMON(condition, returnOnFailure, ...) |
#define | ASSERT_CRASH(condition, ...) |
#define | FORCE_CRASH(...) |
#define | ASSERT_QUIT(condition, returnOnFailure, ...) |
#define | FORCE_QUIT(returnOnFailure, ...) |
Functions | |
MCRO_API void | Mcro::AssertMacros::Detail::SubmitError (EErrorSeverity severity, FString const &codeContext, bool async, bool important, TUniqueFunction< void(IErrorRef const &)> &&extraSetup) |
MCRO_API bool | Mcro::AssertMacros::Detail::IsRunningPIE () |
MCRO_API void | Mcro::AssertMacros::Detail::StopPie () |
By default ASSERT_QUIT|CRASH
macros are also active in Shipping builds. This was a personal preference and that's why you can turn it off if you define MCRO_ASSERT_IGNORE_SHIPPING
.
Definition in file AssertMacros.h.
#define ASSERT_CRASH | ( | condition, | |
... ) |
Use this instead of check
macro if the checked expression shouldn't be ignored in shipping builds. This version will also crash the entire editor even during a PIE session. Use this only if there's absolutely no way to recover from an invalid state, like a situation when early return is not possible / doesn't make sense (e.g.: return a checked pointer by reference).
This macro will attempt to display the error before crashing via the IError type. You can also append extra information to it, or even override preset information like so:
Definition at line 113 of file AssertMacros.h.
#define ASSERT_QUIT | ( | condition, | |
returnOnFailure, | |||
... ) |
Use this instead of check
macro if the checked expression shouldn't be ignored in shipping builds. This version will not crash the editor but will display an error, stops the PIE, and should return the calling function. A return value should be provided on failure, or leave it empty to return void. so either
This is done in the hopes that these checks failing in PIE sessions doesn't crash the entire editor giving the developer a chance for fixing the error before restarting. However early returns might cause undefined/vaguely-defined side effects and may lead to uninitialized resources or in worst case scenario may lead to incorrect states in resource cleanups which then might crash the editor. Always check the validity of your resources in destructors. Failing this check outside of PIE or in a Standalone session will still crash with a check
macro.
This macro will attempt to display the error before quitting via the IError type. You can also append extra information to it like so, or even override preset information like so:
Definition at line 147 of file AssertMacros.h.
#define FORCE_CRASH | ( | ... | ) |
This is equivalent to ASSERT_CRASH but if a code path reaches this macro it will always crash
Definition at line 116 of file AssertMacros.h.
#define FORCE_QUIT | ( | returnOnFailure, | |
... ) |
This is equivalent to ASSERT_QUIT but if a code path reaches this macro it will always quit
Definition at line 150 of file AssertMacros.h.
#define MCRO_ASSERT_CRASH_COMMON | ( | condition, | |
... ) |
Definition at line 83 of file AssertMacros.h.
#define MCRO_ASSERT_CRASH_METHOD |
Definition at line 56 of file AssertMacros.h.
#define MCRO_ASSERT_QUIT_COMMON | ( | condition, | |
returnOnFailure, | |||
... ) |
Definition at line 89 of file AssertMacros.h.
#define MCRO_ASSERT_SUBMIT_ERROR | ( | condition, | |
severity, | |||
async, | |||
important, | |||
... ) |
Definition at line 48 of file AssertMacros.h.
#define MCRO_CRASH_BODY | ( | condition, | |
... ) |
Definition at line 62 of file AssertMacros.h.
#define MCRO_QUIT_BODY | ( | condition, | |
returnOnFailure, | |||
... ) |
Definition at line 69 of file AssertMacros.h.
#define PROPAGATE_FAIL | ( | expression | ) |