ImFusion SDK 4.3
ErrorException Class Reference

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

Error that wraps any C++ exception. More...

+ Inheritance diagram for ErrorException:

Detailed Description

Error that wraps any C++ exception.

This class can be used to catch any C++ exception (not just types inheriting from std::exception but also primitive types) and convert them to a Utils::Error, so that they compose nicely.

Usage example:

Robotics::Expected<int> myFunction() {
try
{
int res = compute();
switch (res)
{
case -1:
throw 5;
case -2:
throw std::runtime_error("error computing my function");
default:
return res;
}
}
catch (...)
{
}
};
Error that wraps any C++ exception.
Definition Error.h:335
T current_exception(T... args)

Public Member Functions

 ErrorException (std::exception_ptr ex)
 
std::string domain () const override
 
int id () const override
 Retrieves the unique identifier for the error.
 
std::string message () const override
 
- Public Member Functions inherited from ErrorInheritanceHelper< ErrorException >
 ~ErrorInheritanceHelper () override=default
 Override destructor.
 
 ErrorInheritanceHelper (const ErrorInterface &ei)
 
std::unique_ptr< ErrorExceptionclone () const &
 Creates a copy of the current instance.
 
- Public Member Functions inherited from ErrorInterface
virtual void handle ()
 Error handling strategy, allows the user to define a task on the constructor of ErrorFrontEnd.
 
template<typename T>
 operator Utils::Expected< T, ErrorFrontEnd > () const &
 Template method for casting to std::expected<T, ErrorFrontEnd>.
 
std::unique_ptr< ErrorInterfaceclone () const &
 Creates a copy of the current instance.
 
bool operator== (const ErrorFrontEnd &other) const
 Compares the id and the domain.
 
bool operator== (const ErrorInterface &other) const
 Compares the id and the domain.
 
virtual ErrorComposition operator| (const ErrorInterface &input) const
 Composition operator.
 

Member Function Documentation

◆ domain()

std::string domain ( ) const
nodiscardoverridevirtual
Returns
String representing the category

Implements ErrorInterface.

◆ id()

int id ( ) const
nodiscardoverridevirtual

Retrieves the unique identifier for the error.

Returns
The error ID.

Implements ErrorInterface.

◆ message()

std::string message ( ) const
nodiscardoverridevirtual
Returns
Human-readable description of the error.

Implements ErrorInterface.


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