ImFusion SDK 4.3
ErrorFrontEnd Class Referencefinal

#include <RoboticsPlugin/Include/ImFusion/Robotics/Error.h>

Error class used by our specialization of Utils::Expected. More...

+ Inheritance diagram for ErrorFrontEnd:

Detailed Description

Error class used by our specialization of Utils::Expected.

This class serves as a container for an ErrorInterface, implementing a strategy pattern to dynamically handle and represent user-defined errors. It can contain a stack of accumulated errors. The list of ids, messages and domains can be accessed through the respective methods. The constructor of ErrorFrontEnd calls handle() on the contained object. This will cause the handling strategy to be executed at that time.

Public Member Functions

 ErrorFrontEnd (std::unique_ptr< ErrorInterface > in)
 Sets the error handling strategy with optional log.
 
 ErrorFrontEnd (const ErrorFrontEnd &)
 
ErrorFrontEndoperator= (const ErrorFrontEnd &)
 
ErrorFrontEndoperator= (ErrorFrontEnd &&) noexcept
 
std::string domain () const
 Returns the category to which the custom error implementation belongs.
 
int id () const
 Retrieves the unique identifier for the error.
 
std::string message () const
 Retrieves the error message.
 
std::vector< std::stringmessages () const
 Returns the eventual list.
 
std::vector< int > ids () const
 Returns the eventual list of ids.
 
std::vector< std::stringdomains () const
 Returns the eventual list of domains.
 
template<typename T>
 operator Utils::Expected< T, ErrorFrontEnd > () const &
 Template method for casting to Utils::Expected<T, ErrorFrontEnd>.
 
template<typename T>
 operator Utils::Expected< T, ErrorFrontEnd > () &&
 Template method for casting to Utils::Expected<T, ErrorFrontEnd>.
 
bool operator== (const ErrorFrontEnd &other) const
 Compares the id and the domain.
 
bool operator== (const ErrorInterface &other) const
 Compares the id and the domain.
 
ErrorFrontEnd operator| (const ErrorInterface &input) const
 

Additional Inherited Members

- Protected Member Functions inherited from NotCopyable
 NotCopyable (NotCopyable &&) noexcept=default
 
NotCopyableoperator= (NotCopyable &&) noexcept=default
 
 NotCopyable (const NotCopyable &)=delete
 
NotCopyableoperator= (const NotCopyable &)=delete
 

Constructor & Destructor Documentation

◆ ErrorFrontEnd()

Sets the error handling strategy with optional log.

strategy A unique pointer to an ErrorInterface implementation

Member Function Documentation

◆ domain()

std::string domain ( ) const
nodiscard

Returns the category to which the custom error implementation belongs.

Returns
string representing the category

◆ id()

int id ( ) const
nodiscard

Retrieves the unique identifier for the error.

Returns
The error ID.

◆ message()

std::string message ( ) const
nodiscard

Retrieves the error message.

Returns
An error message.

◆ operator Utils::Expected< T, ErrorFrontEnd >() [1/2]

template<typename T>
operator Utils::Expected< T, ErrorFrontEnd > ( ) const &
inline

Template method for casting to Utils::Expected<T, ErrorFrontEnd>.

Template Parameters
TThe type of the expected value.
Returns
A Utils::Expected<T, ErrorFrontEnd> containing either the value or the error.

◆ operator Utils::Expected< T, ErrorFrontEnd >() [2/2]

template<typename T>
operator Utils::Expected< T, ErrorFrontEnd > ( ) &&
inline

Template method for casting to Utils::Expected<T, ErrorFrontEnd>.

Template Parameters
TThe type of the expected value.
Returns
A Utils::Expected<T, ErrorFrontEnd> containing either the value or the error.

◆ operator==() [1/2]

bool operator== ( const ErrorFrontEnd & other) const

Compares the id and the domain.

Returns
true if two instances have the same id and domain

◆ operator==() [2/2]

bool operator== ( const ErrorInterface & other) const

Compares the id and the domain.

Returns
true if two instances have the same id and domain

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close