ΒΆtemplate <typename T,
typename RecoveryFtor,
typename... HandlerTs>
Expected<T> handleExpected(
Expected<T> ValOrErr,
RecoveryFtor&& RecoveryPath,
HandlerTs&&... Handlers)
template <typename T,
typename RecoveryFtor,
typename... HandlerTs>
Expected<T> handleExpected(
Expected<T> ValOrErr,
RecoveryFtor&& RecoveryPath,
HandlerTs&&... Handlers)
Description
Handle any errors (if present) in an Expected <T >, then try a recovery path. If the incoming value is a success value it is returned unmodified. If it is a failure value then it the contained error is passed to handleErrors. If handleErrors is able to handle the error then the RecoveryPath functor is called to supply the final result. If handleErrors is not able to handle all errors then the unhandled errors are returned. This utility enables the follow pattern:
Declared at: llvm/include/llvm/Support/Error.h:959
Templates
- T
- RecoveryFtor
- HandlerTs
Parameters
- Expected<T> ValOrErr
- RecoveryFtor&& RecoveryPath
- HandlerTs&&... Handlers