Resilient
|
A detector which detect whether a function throws an exception of a given type. More...
#include <throws.hpp>
Public Member Functions | |
template<typename Q > | |
returned_failure_t< typename FailureDetectorTag< ExceptionThrown< T > >::failure_types > | detect (ICallResult< Q > &result) |
Check whether the result contains an exception of the expected type. More... | |
Public Member Functions inherited from resilient::StatelessDetector< Throws< T > > | |
NoState | preRun () |
Does nothing. More... | |
decltype(auto) | postRun (NoState, ICallResult< T > &result) |
Detect failures by invoking the Detector . More... | |
decltype(auto) | postRun (NoState, ICallResult< T > &result) const |
Additional Inherited Members | |
Public Types inherited from resilient::FailureDetectorTag< ExceptionThrown< T > > | |
using | failure_types = std::tuple< FailureTypes... > |
Tuple composed of the possible failure types the detector can detect. More... | |
A detector which detect whether a function throws an exception of a given type.
If the detected function throws an exception of the expected type then this class returns ExceptionThrown
.
B
derives from A
, Throws<A>
returns a failure if an instance of B
is thrown.Throws
in an Any
detector be sure to put instance especting the most specific exception first and the least specific exception last, otherwise the latter will always detect the exception and the most specific one will never be called.T | The type of the exception. |
|
inline |
Check whether the result contains an exception of the expected type.
Q | The return type of the detected function |
result | The result of invoking the detected function. |
ExceptionThrown
if an exception occurred and the type is the expected one, NoFailure
otherwise.