![]() |
MCRO
C++23 utilities for Unreal Engine.
|
#include "CoreMinimal.h"#include "Templates/ValueOrError.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/TextMacros.h"#include "Mcro/Text.h"#include "Mcro/Delegates/EventDelegate.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 |
| A base class for a structured error handling and reporting with modular architecture and fluent API. More... | |
| class | Mcro::Error::FAssertion |
| A simple error type for checking booleans. It adds no extra features to IError. More... | |
| class | Mcro::Error::FUnavailable |
| A simple error type denoting that whatever is being accessed is not available like attempting to access nullptr. It adds no extra features to IError. More... | |
| struct | Mcro::Error::TMaybe< T > |
A TValueOrError alternative for IError which allows implicit conversion from values and errors (no need for MakeError or MakeValue) and is boolean testable. It also doesn't have ambiguous state such as TValueOrError has, so a TMaybe will always have either an error or a value, it will never have neither of them or both of them. More... | |
Namespaces | |
| namespace | Mcro |
| namespace | Mcro::Error |
| Contains utilities for structured error handling. | |
Macros | |
| #define | MCRO_ERROR_LOG_3(categoryName, verbosity, error) |
| #define | MCRO_ERROR_LOG_2(categoryName, verbosity) |
| #define | ERROR_LOG(...) |
| Convenience macro for logging an error with UE_LOG. | |
| #define | ERROR_CLOG(condition, categoryName, verbosity, error) |
| #define | MCRO_ASSERT_RETURN_2(condition, error) |
| #define | MCRO_ASSERT_RETURN_1(condition) |
| #define | ASSERT_RETURN(...) |
| Similar to check() macro, but return an error instead of crashing. | |
| #define | MCRO_UNAVAILABLE_1(error) |
| #define | UNAVAILABLE(error) |
| Denote that a resource which is asked for doesn't exist. | |
| #define | MCRO_PROPAGATE_FAIL_3(type, var, expression) |
| #define | MCRO_PROPAGATE_FAIL_2(var, expression) |
| #define | MCRO_PROPAGATE_FAIL_1(expression) |
| #define | PROPAGATE_FAIL(...) |
| If a function returns a TMaybe or an FCanFail inside another function which may also return another error use this convenience macro to propagate the failure. | |
Typedefs | |
| using | Mcro::Error::FCanFail = TMaybe<FVoid> |
| Indicate that an otherwise void function that it may fail with an IError. | |
| using | Mcro::Error::FTrueOrReason = TMaybe<FVoid> |
Syntactically same as FCanFail but for functions which is explicitly used to query some boolean decidable thing, and which can also provide a reason why the queried thing is false. | |
Functions | |
| FORCEINLINE FCanFail | Mcro::Error::Success () |
| Return an FCanFail or FTrueOrReason indicating a success or truthy output. | |
Definition in file Error.h.
| #define ASSERT_RETURN | ( | ... | ) |
Similar to check() macro, but return an error instead of crashing.
The following overloads are available:
(condition, error) Specify error type to return(condition) Return FAssertion error | #define ERROR_CLOG | ( | condition, | |
| categoryName, | |||
| verbosity, | |||
| error ) |
| #define ERROR_LOG | ( | ... | ) |
Convenience macro for logging an error with UE_LOG.
The following overloads are available:
(categoryName, verbosity, error) Simply use UE_LOG to log the error(categoryName, verbosity) Log the error preceding this macro (use ERROR_LOG inline). WithLocation is omitted from this overload | #define MCRO_ASSERT_RETURN_1 | ( | condition | ) |
| #define MCRO_ASSERT_RETURN_2 | ( | condition, | |
| error ) |
| #define MCRO_ERROR_LOG_2 | ( | categoryName, | |
| verbosity ) |
| #define MCRO_ERROR_LOG_3 | ( | categoryName, | |
| verbosity, | |||
| error ) |
| #define MCRO_PROPAGATE_FAIL_1 | ( | expression | ) |
| #define MCRO_PROPAGATE_FAIL_2 | ( | var, | |
| expression ) |
| #define MCRO_PROPAGATE_FAIL_3 | ( | type, | |
| var, | |||
| expression ) |
| #define MCRO_UNAVAILABLE_1 | ( | error | ) |
| #define PROPAGATE_FAIL | ( | ... | ) |
If a function returns a TMaybe or an FCanFail inside another function which may also return another error use this convenience macro to propagate the failure.
The following overloads are available:
(expression) Use this when the value of success is not needed further below. This will create a local variable with an automatically determined name and type(var, expression) Use this when the value of success will be used further below. The local variable will be created with auto(type, var, expression) Use this when the value of success will be used further below and its local variable should have an explicit type | #define UNAVAILABLE | ( | error | ) |
Denote that a resource which is asked for doesn't exist.
The following overloads are available:
(error) Specify error type to return() Return FUnavailable error