E-MailRelay
Public Member Functions | List of all members
GNet::ExceptionHandler Class Referenceabstract

An abstract interface for handling exceptions thrown out of event-loop callbacks (socket/future events and timer events). More...

#include <gexceptionhandler.h>

+ Inheritance diagram for GNet::ExceptionHandler:

Public Member Functions

virtual ~ExceptionHandler ()
 Destructor. More...
 
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. More...
 
 ExceptionHandler (const ExceptionHandler &)=delete
 
 ExceptionHandler (ExceptionHandler &&)=default
 
ExceptionHandleroperator= (const ExceptionHandler &)=delete
 
ExceptionHandleroperator= (ExceptionHandler &&)=default
 

Detailed Description

An abstract interface for handling exceptions thrown out of event-loop callbacks (socket/future events and timer events).

If the handler just rethrows then the event loop will terminate.

The ExceptionHandler destructor calls disarm() on the EventLoop and TimerList so that an onException() callback is not delivered if the target object has been destroyed.

Definition at line 43 of file gexceptionhandler.h.

Constructor & Destructor Documentation

◆ ~ExceptionHandler()

GNet::ExceptionHandler::~ExceptionHandler ( )
virtual

Destructor.

Matching entries in the EventLoop and TimerList are disarm()ed.

Definition at line 26 of file gexceptionhandler.cpp.

Member Function Documentation

◆ onException()

virtual void GNet::ExceptionHandler::onException ( ExceptionSource source,
std::exception &  e,
bool  done 
)
pure virtual

Called by the event loop when an exception is thrown out of an event loop callback.

The exception is still active so it can be rethrown with "throw" or captured with std::current_exception().

The source parameter can be used to point to the object that received the original event loop callback. This requires the appropriate exception source pointer is defined when the event source is first registered with the event loop, otherwise it defaults to a null pointer. (The EventStateUnbound class is used where necessary to encourage the definition of a valid exception source pointer.)

The 'done' parameter indicates whether the exception was of type GNet::Done.


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