31 namespace EventStateImp
33 struct LogExceptionHandler : ExceptionHandler
35 void onException( ExceptionSource * , std::exception & e ,
bool net_done )
override
38 G_LOG(
"GNet::EventState: exception: " << e.what() ) ;
52 static EventStateImp::LogExceptionHandler log_only_exception_handler ;
54 es.m_eh = &log_only_exception_handler ;
60 return {
Private() , nullptr ,
nullptr } ;
66 G_ASSERT( logging !=
nullptr ) ;
68 copy.m_logging = logging ;
81 G_ASSERT( m_eh !=
nullptr ) ;
82 m_eh->onException( m_esrc , e , done ) ;
An interface for GNet classes that define a logging context string.
EventStateUnbound(EventState) noexcept
Constructor. See also EventState::unbound().
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
EventState esrc(Private, ExceptionSource *) const noexcept
Returns a copy of this object with the ExceptionSource pointer set.
EventState(Private, ExceptionHandler *eh, ExceptionSource *source) noexcept
Constructor used by event loops etc.
void doOnException(std::exception &e, bool done)
Calls the exception handler's onException() method.
static EventState create()
A factory function for an exception handler that rethrows.
void disarm() noexcept
Resets the exception handler.
EventLogging * logging() const noexcept
Returns the event logging pointer.
ExceptionSource * esrc() const noexcept
Returns the exception source pointer.
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket/future event...
virtual void onException(ExceptionSource *source, std::exception &e, bool done)=0
Called by the event loop when an exception is thrown out of an event loop callback.
A mixin base class that identifies the source of an exception when delivered to GNet::ExceptionHandle...
Overload discriminator for GNet::EventState.