For constructing an Unexpected object from an error code. Unexpected objects are implicitly convertible to Expected object in the error state. Usage is as follows:
Declared in <folly/Expected.h>
template<class Error>
constexpr
Unexpected<std::decay<Error>::type>
makeUnexpected(Error&& err);
enum class MyErrorCode { BAD_ERROR, WORSE_ERROR }; Expected<int, MyErrorCode> myAPI() { int i = // ...; return i ? makeExpected<MyErrorCode>(i) : makeUnexpected(MyErrorCode::BAD_ERROR); }
An Unexpected holding a decayed copy of err.
| Name | Description |
|---|---|
| err | The error value to wrap. |