MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Mcro::Error::FErrorManager Class Reference

Global facilities for IError handling, including displaying them to the user, trigger error events, etc. More...

#include <ErrorManager.h>

Public Types

enum  EDisplayErrorResult { Displayed , Suppressed_AnotherErrorOpen , Suppressed_CannotDisplayModalWindow }
 The results of displaying an error. In all cases the error is logged. More...
 

Public Member Functions

auto DisplayError (IErrorRef const &error, FDisplayErrorArgs const &args) -> TFuture< EDisplayErrorResult >
 Display the error summary for the user. Only use this when your program arrives to an unrecoverable state which either needs explanation for the user or requires action from the user (like configuration changes).
 

Static Public Member Functions

static FErrorManagerGet ()
 Get the global singleton.
 

Data Fields

TEventDelegate< void()> OnErrorDialogDismissed
 

Detailed Description

Global facilities for IError handling, including displaying them to the user, trigger error events, etc.

Definition at line 74 of file ErrorManager.h.

Member Enumeration Documentation

◆ EDisplayErrorResult

The results of displaying an error. In all cases the error is logged.

Enumerator
Displayed 

The error has been displayed for the user.

Suppressed_AnotherErrorOpen 

The error has not been shown to the user because another error is already being shown.

Suppressed_CannotDisplayModalWindow 

Modal windows couldn't be created at the time, so we couldn't show it to the user either.

Definition at line 82 of file ErrorManager.h.

Member Function Documentation

◆ DisplayError()

auto Mcro::Error::FErrorManager::DisplayError ( IErrorRef const & error,
FDisplayErrorArgs const & args ) -> TFuture< EDisplayErrorResult >

Display the error summary for the user. Only use this when your program arrives to an unrecoverable state which either needs explanation for the user or requires action from the user (like configuration changes).

Important
The modal window and the widgets representing the error will be created on the main thread, keep that in mind while making the widgets for the errors.
Parameters
errorThe input error
argsSimple arguments object for this function, use initializer list or C++ 20 designated initializer.
Returns
A future telling that either the dialog has been displayed or how it has been suppressed. The future also gives an opportunity to block the calling thread until the user acknowledges the error.
Remarks
Unless bAsync is set in the arguments, calling this function from any thread will also block the main thread while the modal window containing the error is open. If the calling thread also needs to be blocked then simply wait on the returned future.
Todo
Add ability to let the user "ignore" errors, and continue execution, because they know better.

◆ Get()

static FErrorManager & Mcro::Error::FErrorManager::Get ( )
static

Get the global singleton.

Field Documentation

◆ OnErrorDialogDismissed

TEventDelegate<void()> Mcro::Error::FErrorManager::OnErrorDialogDismissed

Definition at line 120 of file ErrorManager.h.


The documentation for this class was generated from the following file: