71 template <
typename TCode =
int>
97 default:
return "Unspecified";
109template <
typename TCode,
typename TDesc>
127 constexpr operator bool()
const {
return ok(); }
141 <<
" Desc=\"" << (status.
desc.has_value() ? status.
desc.value() :
"") <<
"\"";
152 std::ostringstream buf;
Defines error codes with a default unspecified value.
Definition tec_status.hpp:72
static constexpr const TCode Unspecified
Default unspecified error code.
Definition tec_status.hpp:73
Defines error types and codes for error handling in the tec library.
Definition tec_status.hpp:44
Kind
Enumerates possible error categories.
Definition tec_status.hpp:50
@ Invalid
Invalid data or state.
@ NetErr
Network-related error.
@ TimeoutErr
Timeout during an operation.
@ NotImplemented
Not implemented.
@ System
System-level error.
@ Ok
Indicates successful execution.
@ RuntimeErr
Runtime error during execution.
@ Unsupported
The feature is unsupported.
@ RpcErr
Remote procedure call error.
@ IOErr
Input/output operation failure.
Represents the status of an execution with error details.
Definition tec_status.hpp:110
std::optional< TDesc > desc
Optional error description.
Definition tec_status.hpp:113
Error::Kind kind
The error category.
Definition tec_status.hpp:111
TStatus()
Constructs a successful status.
Definition tec_status.hpp:162
TStatus(const TDesc &_desc, Error::Kind _kind=Error::Kind::Err)
Constructs an error status with a description.
Definition tec_status.hpp:185
TStatus(const TCode &_code, Error::Kind _kind=Error::Kind::Err)
Constructs an error status with a code.
Definition tec_status.hpp:199
constexpr bool ok() const
Checks if the status indicates success.
Definition tec_status.hpp:120
std::string as_string()
Converts the status to a string representation.
Definition tec_status.hpp:151
TStatus(Error::Kind _kind)
Constructs an error status with an unspecified code.
Definition tec_status.hpp:172
friend std::ostream & operator<<(std::ostream &out, const TStatus &status)
Outputs the status to an output stream.
Definition tec_status.hpp:137
TStatus(const TCode &_code, const TDesc &_desc, Error::Kind _kind=Error::Kind::Err)
Constructs an error status with code and description.
Definition tec_status.hpp:212
std::optional< TCode > code
Optional error code.
Definition tec_status.hpp:112
Common definitions and utilities for the tec namespace.
constexpr const char * kind_as_string(Error::Kind k)
Converts an Error::Kind value to its string representation.
Definition tec_status.hpp:84