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

#include <CppException.h>

Inheritance diagram for Mcro::Error::FCppException:
Mcro::Error::IError Mcro::Types::IHaveType Mcro::Error::TCppException< Exception >

Public Member Functions

 FCppException (std::exception const &input)
 
virtual ~FCppException ()=default
 
virtual TSharedRef< SErrorDisplayCreateErrorWidget () override
 
- Public Member Functions inherited from Mcro::Error::IError
FORCEINLINE decltype(InnerErrors) ::TRangedForIterator begin ()
 
FORCEINLINE decltype(InnerErrors) ::TRangedForConstIterator begin () const
 
FORCEINLINE decltype(InnerErrors) ::TRangedForIterator end ()
 
FORCEINLINE decltype(InnerErrors) ::TRangedForConstIterator end () const
 
void Initialize ()
 
virtual void SerializeYaml (YAML::Emitter &emitter, bool isRoot) const
 
FString ToString () const
 
std::string ToStringUtf8 () const
 
FORCEINLINE EErrorSeverity GetSeverity () const
 
FORCEINLINE int32 GetSeverityInt () const
 
FORCEINLINE FString const & GetMessage () const
 
FORCEINLINE FString const & GetDetails () const
 
FORCEINLINE FString const & GetCodeContext () const
 
FORCEINLINE TMap< FString, IErrorRef > const & GetInnerErrors () const
 
FORCEINLINE int32 GetInnerErrorCount () const
 
TArray< FString > GetErrorPropagation () const
 
FString GetErrorPropagationJoined () const
 
FStringView GetSeverityString () const
 
template<typename Self >
SelfRef< Self > WithMessage (this Self &&self, const FString &input, bool condition=true)
 
template<typename Self , typename... FormatArgs>
SelfRef< Self > WithMessageF (this Self &&self, const TCHAR *input, FormatArgs &&... fmtArgs)
 
template<typename Self , typename... FormatArgs>
SelfRef< Self > WithMessageFC (this Self &&self, bool condition, const TCHAR *input, FormatArgs &&... fmtArgs)
 
template<typename Self >
SelfRef< Self > WithSeverity (this Self &&self, EErrorSeverity input)
 
template<typename Self >
SelfRef< Self > AsRecoverable (this Self &&self)
 
template<typename Self >
SelfRef< Self > AsFatal (this Self &&self)
 
template<typename Self >
SelfRef< Self > AsCrashing (this Self &&self)
 
template<typename Self >
SelfRef< Self > WithDetails (this Self &&self, const FString &input, bool condition=true)
 
template<typename Self , typename... FormatArgs>
SelfRef< Self > WithDetailsF (this Self &&self, const TCHAR *input, FormatArgs &&... fmtArgs)
 
template<typename Self , typename... FormatArgs>
SelfRef< Self > WithDetailsFC (this Self &&self, bool condition, const TCHAR *input, FormatArgs &&... fmtArgs)
 
template<typename Self >
SelfRef< Self > WithCodeContext (this Self &&self, const FString &input, bool condition=true)
 
template<typename Self , CError Error>
SelfRef< Self > WithError (this Self &&self, const TSharedRef< Error > &input, bool condition=true)
 
template<typename Self , CError Error>
SelfRef< Self > WithError (this Self &&self, const FString &name, const TSharedRef< Error > &input, bool condition=true)
 
template<typename Self >
SelfRef< Self > WithErrors (this Self &&self, const TArray< TTuple< FString, IErrorRef > > &input, bool condition=true)
 
template<typename Self , CError... Errors>
SelfRef< Self > WithErrors (this Self &&self, const TSharedRef< Errors > &... errors)
 
template<typename Self , CError... Errors>
SelfRef< Self > WithErrors (this Self &&self, bool condition, const TSharedRef< Errors > &... errors)
 
template<typename Self >
SelfRef< Self > WithAppendix (this Self &&self, const FString &name, const FString &text, bool condition=true)
 
template<typename Self , typename... FormatArgs>
SelfRef< Self > WithAppendixF (this Self &&self, const FString &name, const TCHAR *text, FormatArgs &&... fmtArgs)
 
template<typename Self , typename... FormatArgs>
SelfRef< Self > WithAppendixFC (this Self &&self, bool condition, const FString &name, const TCHAR *text, FormatArgs &&... fmtArgs)
 
template<typename Self >
SelfRef< Self > Notify (this Self &&self, Observable::IState< IErrorPtr > &state)
 
template<typename Self >
SelfRef< Self > BreakDebugger (this Self &&self)
 
template<typename Self >
SelfRef< Self > WithCppStackTrace (this Self &&self, const FString &name={}, bool condition=true, int32 numAdditionalStackFramesToIgnore=0, bool fastWalk=!UE_BUILD_DEBUG)
 
template<typename Self >
SelfRef< Self > WithBlueprintStackTrace (this Self &&self, const FString &name={}, bool condition=true)
 
template<typename Self >
SelfRef< Self > WithLocation (this Self &&self, std::source_location location=std::source_location::current())
 
- Public Member Functions inherited from Mcro::Types::IHaveType
virtual ~IHaveType ()=default
 
template<typename Self >
SelfRef< Self > WithType (this Self &&self)
 
FORCEINLINE FName const & GetType () const
 
template<typename Derived , typename Self >
TSharedPtr< Derived > AsExactly (this Self &&self)
 

Data Fields

std::exception BaseException
 

Protected Member Functions

virtual FStringView GetExceptionType () const
 
virtual void SerializeMembers (YAML::Emitter &emitter, bool isRoot) const override
 
- Protected Member Functions inherited from Mcro::Error::IError
virtual void SerializeInnerErrors (YAML::Emitter &emitter) const
 
virtual void SerializeErrorPropagation (YAML::Emitter &emitter) const
 
virtual void AddError (const FString &name, const TSharedRef< IError > &error, const FString &typeOverride={})
 
virtual void AddAppendix (const FString &name, const FString &text, const FString &type=TEXT("Appendix"))
 
void AddCppStackTrace (const FString &name, int32 numAdditionalStackFramesToIgnore, bool fastWalk)
 
void AddBlueprintStackTrace (const FString &name)
 
virtual void NotifyState (Observable::IState< IErrorPtr > &state)
 
- Protected Member Functions inherited from Mcro::Types::IHaveType
template<typename Self >
void SetType (this Self &&self)
 

Additional Inherited Members

- Public Types inherited from Mcro::Types::IHaveType
template<typename Self >
using SelfRef = TSharedRef<std::decay_t<Self>>
 
- Static Public Member Functions inherited from Mcro::Error::IError
template<CError T, typename... Args>
requires CSharedInitializeable<T, Args...>
static TSharedRef< T > Make (T *newError, Args &&... args)
 
- Protected Attributes inherited from Mcro::Error::IError
TMap< FString, IErrorRefInnerErrors
 
TArray< std::source_location > ErrorPropagation
 
EErrorSeverity Severity = EErrorSeverity::ErrorComponent
 
FString Message
 
FString Details
 
FString CodeContext
 
- Protected Attributes inherited from Mcro::Types::IHaveType
FName TypeName
 

Detailed Description

Unreal itself discourages the usage of C++ exceptions and there are also couple of thoughts above IError why that's the case. However there are third-party libraries which may require their users to catch errors their functions may yield via exceptions. For this reason there's an IError wrapper around std::exception base class which however will not preserve the actual type of the cought exception. For that use TCppException template.

Definition at line 27 of file CppException.h.

Constructor & Destructor Documentation

◆ FCppException()

Mcro::Error::FCppException::FCppException ( std::exception const & input)

◆ ~FCppException()

virtual Mcro::Error::FCppException::~FCppException ( )
virtualdefault

Member Function Documentation

◆ CreateErrorWidget()

virtual TSharedRef< SErrorDisplay > Mcro::Error::FCppException::CreateErrorWidget ( )
overridevirtual

Override this function to customize how an error is displaxed for the end-user

Reimplemented from Mcro::Error::IError.

◆ GetExceptionType()

virtual FStringView Mcro::Error::FCppException::GetExceptionType ( ) const
protectedvirtual

◆ SerializeMembers()

virtual void Mcro::Error::FCppException::SerializeMembers ( YAML::Emitter & emitter,
bool isRoot ) const
overrideprotectedvirtual

Override this method if direct members should be serialized differently or extra members are added by derived errors.

Reimplemented from Mcro::Error::IError.

Field Documentation

◆ BaseException

std::exception Mcro::Error::FCppException::BaseException

Storage for the exception but as the base STL type. It's copied to this member

Definition at line 36 of file CppException.h.


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