Carries the caller's choice between exceptions and error codes.
More...
#include <averror.h>
|
| | OptionalErrorCode (std::error_code &ec) |
| | Report errors through the given variable.
|
| | operator bool () const |
| | Whether the caller supplied an error code variable.
|
| std::error_code & | operator* () |
| | The caller's variable.
|
|
| static OptionalErrorCode | null () |
| | The value that means "the caller wants no error code".
|
A function that can fail takes an OptionalErrorCode as its last parameter. The default is throws(), which makes the function throw av::Exception; passing a std::error_code& makes it store the code instead. The object is a non-owning pointer to that variable, so the variable must outlive the call.
- Examples
- api2-generate-subtitles.cpp.
◆ OptionalErrorCode()
| av::OptionalErrorCode::OptionalErrorCode |
( |
std::error_code & | ec | ) |
|
- Parameters
-
| ec | the variable that receives the error; it must outlive the call |
◆ null()
| OptionalErrorCode av::OptionalErrorCode::null |
( |
| ) |
|
|
static |
- Returns
- an empty holder; used by throws() as the default argument
◆ operator bool()
| av::OptionalErrorCode::operator bool |
( |
| ) |
const |
- Returns
- true when a variable was passed
◆ operator*()
| std::error_code & av::OptionalErrorCode::operator* |
( |
| ) |
|
- Returns
- the variable the holder points at
The documentation for this class was generated from the following file: