MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Error.Fwd.h
Go to the documentation of this file.
1/** @noop License Comment
2 * @file
3 * @copyright
4 * This Source Code is subject to the terms of the Mozilla Public License, v2.0.
5 * If a copy of the MPL was not distributed with this file You can obtain one at
6 * https://mozilla.org/MPL/2.0/
7 *
8 * @author David Mórász
9 * @date 2025
10 */
11
12#pragma once
13
14#include "CoreMinimal.h"
15#include "Mcro/Concepts.h"
16
17/** @brief Contains utilities for structured error handling */
18namespace Mcro::Error
19{
20 using namespace Mcro::Concepts;
21
22 class IError;
23 class SErrorDisplay;
24
25 using IErrorRef = TSharedRef<IError>; /**< @brief Convenience alias for an instance of an error */
26 using IErrorPtr = TSharedPtr<IError>; /**< @brief Convenience alias for an instance of an error */
27 using IErrorWeakPtr = TWeakPtr<IError>; /**< @brief Convenience alias for an instance of an error */
28
29 using FNamedError = TPair<FString, IErrorRef>;
30
31 /** @brief Concept constraining input type argument T to an IError */
32 template <typename T>
33 concept CError = CDerivedFrom<T, IError>;
34
35 /** @brief Concept constraining input type argument T to be an IErrorRef */
36 template <typename T>
37 concept CErrorRef = CSharedRef<T> && CError<typename T::ElementType>;
38
39 /** @brief Concept constraining input type argument T to be an IErrorPtr */
40 template <typename T>
41 concept CErrorPtr = CSharedPtr<T> && CError<typename T::ElementType>;
42
43 /** @brief Concept constraining input type argument T to be an IErrorPtr */
44 template <typename T>
46
47 /** @brief Concept constraining input type argument T to be an IErrorPtr */
48 template <typename T>
50
51 /** @brief Indicate the severity of an error and at what discretion the caller may treat it. */
52 enum class EErrorSeverity
53 {
54 /** @brief Indicates that an inner error just contains extra context for a real error */
55 ErrorComponent = -1,
56
57 /** @brief The caller can handle the error and may continue execution, for example errors with telemetry. */
59
60 /**
61 * @brief
62 * A sub-program (like PIE) or a thread should abort its entire purpose but it should not crash the entire
63 * encompassing application, for example early runtime checks about the correctness of some required configuration.
64 */
65 Fatal,
66
67 /**
68 * @brief
69 * The application has arrived to an invalid state from which recovery is impossible, for example access
70 * violation errors.
71 */
73 };
74}
This header exists because STL headers in Android doesn't define STL concepts (other than same_as whi...
A base class for a structured error handling and reporting with modular architecture and fluent API.
Definition Error.h:68
Base class for displaying Mcro::Error::IError objects to the user.
Concept constraining input type argument T to be an IErrorPtr.
Definition Error.Fwd.h:41
Concept constraining input type argument T to be an IErrorPtr.
Definition Error.Fwd.h:45
Concept constraining input type argument T to be an IErrorRef.
Definition Error.Fwd.h:37
Concept constraining input type argument T to an IError.
Definition Error.Fwd.h:33
Concept constraining input type argument T to be an IErrorPtr.
Definition Error.Fwd.h:49
Contains utilities for structured error handling.
Definition Error.Fwd.h:19
TSharedRef< IError > IErrorRef
Convenience alias for an instance of an error.
Definition Error.Fwd.h:25
TWeakPtr< IError > IErrorWeakPtr
Convenience alias for an instance of an error.
Definition Error.Fwd.h:27
TPair< FString, IErrorRef > FNamedError
Definition Error.Fwd.h:29
TSharedPtr< IError > IErrorPtr
Convenience alias for an instance of an error.
Definition Error.Fwd.h:26
EErrorSeverity
Indicate the severity of an error and at what discretion the caller may treat it.
Definition Error.Fwd.h:53
@ Recoverable
The caller can handle the error and may continue execution, for example errors with telemetry.
@ Fatal
A sub-program (like PIE) or a thread should abort its entire purpose but it should not crash the enti...
@ ErrorComponent
Indicates that an inner error just contains extra context for a real error.
@ Crashing
The application has arrived to an invalid state from which recovery is impossible,...