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 &&)=delete
 
void operator= (const ExceptionHandler &)=delete
 
void operator= (ExceptionHandler &&)=delete
 

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 EventHandlerList 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 EventHandlerList 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".

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 ExceptionSinkUnbound 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.

Implemented in GNet::ExceptionSinkImp::RethrowExceptionHandler.


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