FastLED 3.10.8
Loading...
Searching...
No Matches

◆ error()

template<typename T>
const Error & fl::task::PromiseResult< T >::error ( ) const
inline

Get the error value.

Returns
Reference to the error
Warning
Returns static descriptive error if called on a success result
Note
Use !ok() to check before calling for proper error handling

Definition at line 103 of file promise_result.h.

103 {
104 if (ok()) {
105 // Return descriptive error for misuse detection
106 static const Error empty_error("No error - result contains success value");
107 return empty_error;
108 }
109 return mResult.template get<Error>();
110 }
fl::variant< T, Error > mResult
bool ok() const FL_NO_EXCEPT
Check if the result is successful.
Result type for promise operations.
pair_element< I, T1, T2 >::type & get(pair< T1, T2 > &p) FL_NO_EXCEPT
Definition pair.h:119

References fl::FL_NO_EXCEPT, fl::get(), mResult, and ok().

Referenced by PromiseResult(), PromiseResult(), and error_message().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: