ReXGlue SDK
Loading...
Searching...
No Matches
rex::Error Struct Reference

#include <rex/result.h>

Public Member Functions

 Error (ErrorCategory cat, std::string msg, int err_code=0)
bool IsSuccess () const noexcept
std::string GetDescription () const

Static Public Member Functions

static Error FromErrno (ErrorCategory cat, std::string msg, int errno_value)

Public Attributes

ErrorCategory category = ErrorCategory::kNoError
std::string message
int code = 0

Detailed Description

An error value carried by rex::Result.

Constructor & Destructor Documentation

◆ Error()

rex::Error::Error ( ErrorCategory cat,
std::string msg,
int err_code = 0 )
inline

Creates an error.

Parameters
err_codeCode from the platform or a library.

Member Function Documentation

◆ GetDescription()

std::string rex::Error::GetDescription ( ) const
inlinenodiscard
Returns
"Success" when the category is kNoError, otherwise the message with the code appended when it is not 0.

◆ IsSuccess()

bool rex::Error::IsSuccess ( ) const
inlinenodiscardnoexcept

Reports whether the error is a success.

Returns
True when the category is kNoError.

Member Data Documentation

◆ code

int rex::Error::code = 0

Code from the platform or a library.


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