proxygen
folly::gen::detail::GuardImpl< Exception, ErrorHandler > Class Template Reference

#include <Base-inl.h>

Inheritance diagram for folly::gen::detail::GuardImpl< Exception, ErrorHandler >:
folly::gen::Operator< GuardImpl< Exception, ErrorHandler > > folly::gen::FBounded< Self >

Classes

class  Generator
 

Public Member Functions

 GuardImpl (ErrorHandler handler)
 
template<class Value , class Source , class Gen = Generator<Value, Source>>
Gen compose (GenImpl< Value, Source > &&source) const
 
template<class Value , class Source , class Gen = Generator<Value, Source>>
Gen compose (const GenImpl< Value, Source > &source) const
 
- Public Member Functions inherited from folly::gen::Operator< GuardImpl< Exception, ErrorHandler > >
ResultGen compose (const GenImpl< Value, Source > &source) const
 
- Public Member Functions inherited from folly::gen::FBounded< Self >
const Self & self () const
 
Self & self ()
 

Private Attributes

ErrorHandler handler_
 

Additional Inherited Members

- Protected Member Functions inherited from folly::gen::Operator< GuardImpl< Exception, ErrorHandler > >
 Operator ()=default
 
 Operator (Operator &&) noexcept=default
 
 Operator (const Operator &)=default
 
Operatoroperator= (Operator &&) noexcept=default
 
Operatoroperator= (const Operator &)=default
 

Detailed Description

template<class Exception, class ErrorHandler>
class folly::gen::detail::GuardImpl< Exception, ErrorHandler >

GuardImpl - For handling exceptions from downstream computation. Requires the type of exception to catch, and handler function to invoke in the event of the exception. Note that the handler may: 1) return true to continue processing the sequence 2) return false to end the sequence immediately 3) throw, to pass the exception to the next catch The handler must match the signature 'bool(Exception&, Value)'.

This type is used through the guard helper, like so:

auto indexes = byLine(STDIN_FILENO) | guard<std::runtime_error>([](std::runtime_error& e, StringPiece sp) { LOG(ERROR) << sp << ": " << e.str(); return true; // continue processing subsequent lines }) | eachTo<int>() | as<vector>();

TODO(tjackson): Rename this back to Guard.

Definition at line 1754 of file Base-inl.h.

Constructor & Destructor Documentation

template<class Exception , class ErrorHandler >
folly::gen::detail::GuardImpl< Exception, ErrorHandler >::GuardImpl ( ErrorHandler  handler)
inlineexplicit

Definition at line 1758 of file Base-inl.h.

1758 : handler_(std::move(handler)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void handler(int, siginfo_t *, void *)

Member Function Documentation

template<class Exception , class ErrorHandler >
template<class Value , class Source , class Gen = Generator<Value, Source>>
Gen folly::gen::detail::GuardImpl< Exception, ErrorHandler >::compose ( GenImpl< Value, Source > &&  source) const
inline

Definition at line 1786 of file Base-inl.h.

References folly::gen::move.

1786  {
1787  return Gen(std::move(source.self()), handler_);
1788  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<class Exception , class ErrorHandler >
template<class Value , class Source , class Gen = Generator<Value, Source>>
Gen folly::gen::detail::GuardImpl< Exception, ErrorHandler >::compose ( const GenImpl< Value, Source > &  source) const
inline

Definition at line 1791 of file Base-inl.h.

References folly::gen::FBounded< Self >::self().

1791  {
1792  return Gen(source.self(), handler_);
1793  }

Member Data Documentation

template<class Exception , class ErrorHandler >
ErrorHandler folly::gen::detail::GuardImpl< Exception, ErrorHandler >::handler_
private

Definition at line 1755 of file Base-inl.h.


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