proxygen
folly::exception_wrapper::HandleReduce< IsConst > Struct Template Reference

#include <ExceptionWrapper-inl.h>

Public Member Functions

template<class ThrowFn , class CatchFn , FOLLY_REQUIRES(!IsCatchAll< CatchFn >::value) >
auto operator() (ThrowFn &&th, CatchFn &ca) const
 
template<class ThrowFn , class CatchFn , FOLLY_REQUIRES(IsCatchAll< CatchFn >::value) >
auto operator() (ThrowFn &&th, CatchFn &ca) const
 

Public Attributes

bool * handled_
 

Detailed Description

template<bool IsConst>
struct folly::exception_wrapper::HandleReduce< IsConst >

Definition at line 495 of file ExceptionWrapper-inl.h.

Member Function Documentation

template<bool IsConst>
template<class ThrowFn , class CatchFn , FOLLY_REQUIRES(!IsCatchAll< CatchFn >::value) >
auto folly::exception_wrapper::HandleReduce< IsConst >::operator() ( ThrowFn &&  th,
CatchFn &  ca 
) const
inline

Definition at line 502 of file ExceptionWrapper-inl.h.

References FOLLY_REQUIRES.

502  {
503  using Ex = _t<ExceptionTypeOf<CatchFn, IsConst>>;
504  return [th = std::forward<ThrowFn>(th), &ca, handled_ = handled_] {
505  try {
506  th();
507  } catch (Ex& e) {
508  // If we got here because a catch function threw, rethrow.
509  if (*handled_) {
510  throw;
511  }
512  *handled_ = true;
513  ca(e);
514  }
515  };
516  }
template<bool IsConst>
template<class ThrowFn , class CatchFn , FOLLY_REQUIRES(IsCatchAll< CatchFn >::value) >
auto folly::exception_wrapper::HandleReduce< IsConst >::operator() ( ThrowFn &&  th,
CatchFn &  ca 
) const
inline

Definition at line 522 of file ExceptionWrapper-inl.h.

522  {
523  return [th = std::forward<ThrowFn>(th), &ca, handled_ = handled_] {
524  try {
525  th();
526  } catch (...) {
527  // If we got here because a catch function threw, rethrow.
528  if (*handled_) {
529  throw;
530  }
531  *handled_ = true;
532  ca();
533  }
534  };
535  }

Member Data Documentation

template<bool IsConst>
bool* folly::exception_wrapper::HandleReduce< IsConst >::handled_

Definition at line 496 of file ExceptionWrapper-inl.h.


The documentation for this struct was generated from the following file: