#include <RoboticsPlugin/Include/ImFusion/Robotics/Error.h>
An interface for error handling and representation.
More...
An interface for error handling and representation.
This interface defines a common interface for all error handling and representation types. Representation of various errors is done via the exposition additional properties: id, message, and domain.
- id: A unique identifier for the error within its domain.
- message: A human-readable description of the error.
- domain: This property indicates the "category" or source of the error, disambiguating errors using the same id coming from different sources and allowing the tracking of errors back to their specific library or module. It identifies which specialization of the ErrorInterface the class is currently using.
|
|
virtual void | handle () |
| | Error handling strategy, allows the user to define a task on the constructor of ErrorFrontEnd.
|
| virtual std::string | domain () const =0 |
| | Returns the category to which the custom error implementation belongs.
|
| virtual int | id () const =0 |
| | Retrieves the unique identifier for the error.
|
| virtual std::string | message () const =0 |
| | Retrieves the error message.
|
| template<typename T> |
| | operator Utils::Expected< T, ErrorFrontEnd > () const & |
| | Template method for casting to std::expected<T, ErrorFrontEnd>.
|
| std::unique_ptr< ErrorInterface > | clone () 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.
|
◆ domain()
| virtual std::string ImFusion::Robotics::ErrorInterface::domain |
( |
| ) |
const |
|
nodiscardpure virtual |
Returns the category to which the custom error implementation belongs.
- Returns
- string representing the category
◆ id()
| virtual int ImFusion::Robotics::ErrorInterface::id |
( |
| ) |
const |
|
nodiscardpure virtual |
Retrieves the unique identifier for the error.
- Returns
- The error ID.
◆ message()
| virtual std::string ImFusion::Robotics::ErrorInterface::message |
( |
| ) |
const |
|
nodiscardpure virtual |
Retrieves the error message.
This method is abstract to force the user to instantiate the error with the correct message.
- Returns
- An error message.
◆ operator Utils::Expected< T, ErrorFrontEnd >()
Template method for casting to std::expected<T, ErrorFrontEnd>.
- Template Parameters
-
| T | The type of the expected value. |
- Returns
- A Utils::Expected<T, ErrorFrontEnd> containing either the value or the error.
◆ clone()
| std::unique_ptr< ErrorInterface > ImFusion::Robotics::ErrorInterface::clone |
( |
| ) |
const & |
|
inlinenodiscard |
Creates a copy of the current instance.
This method performs a deep copy of the current instance and returns a new dynamically allocated instance that is a clone of this object.
- Returns
- A unique pointer to the newly cloned instance.
◆ operator==() [1/2]
| bool ImFusion::Robotics::ErrorInterface::operator== |
( |
const ErrorFrontEnd & | other | ) |
const |
|
inline |
Compares the id and the domain.
- Returns
- true if two instances have the same id and domain
◆ operator==() [2/2]
| bool ImFusion::Robotics::ErrorInterface::operator== |
( |
const ErrorInterface & | other | ) |
const |
|
inline |
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:
- RoboticsPlugin/Include/ImFusion/Robotics/Error.h