About
The error reporting system of the MAXON API is based on the maxon::Result template. Such a maxon::Result object can contain both the actual return value of the function and an error object if an error had occurred.
Result
These default error values are used to check if a maxon::Result object contains an error or not:
- Note
- maxon::OK can be used as a return value. But it is not possible to use maxon::FAILED as a return value. A proper error object must be returned instead.
-
The return value of a function returning maxon::Result<void> should be documented as "OK on success".
{
if (number == nullptr)
*number = *number + 1;
}
Result Class
A maxon::ResultBase / maxon::Result object stores the return value and the error returned by a function.
The stored value and error are accessed with:
- Note
- Typically errors should be handled with iferr_scope and iferr_return, see Error Handling.
{
}
{
const maxon::Error error = res.
GetError();
}
Special Classes
For special situations these specialized return values exist:
{
}
class PrintNumbers
{
public:
{
};
{
PrintFloat(f);
};
};
Further Reading