CppCommon  1.0.4.1
C++ Common Library
Public Member Functions | Static Public Member Functions | List of all members
CppCommon::ExceptionsHandler Class Reference

Exceptions handler. More...

#include <exceptions_handler.h>

Inheritance diagram for CppCommon::ExceptionsHandler:
CppCommon::Singleton< ExceptionsHandler >

Public Member Functions

 ExceptionsHandler (const ExceptionsHandler &)=delete
 
 ExceptionsHandler (ExceptionsHandler &&)=delete
 
 ~ExceptionsHandler ()
 
ExceptionsHandleroperator= (const ExceptionsHandler &)=delete
 
ExceptionsHandleroperator= (ExceptionsHandler &&)=delete
 
- Public Member Functions inherited from CppCommon::Singleton< ExceptionsHandler >
 Singleton (const Singleton &)=delete
 
 Singleton (Singleton &&)=delete
 
Singletonoperator= (const Singleton &)=delete
 
Singletonoperator= (Singleton &&)=delete
 

Static Public Member Functions

static void SetupHandler (const std::function< void(const SystemException &, const StackTrace &)> &handler)
 Setup new global exceptions handler function. More...
 
static void SetupProcess ()
 Setup exceptions handler for the current process. More...
 
static void SetupThread ()
 Setup exceptions handler for the current thread. More...
 
- Static Public Member Functions inherited from CppCommon::Singleton< ExceptionsHandler >
static ExceptionsHandlerGetInstance ()
 Get singleton instance. More...
 

Detailed Description

Exceptions handler.

Exceptions handler allows to setup special handlers for all process and thread exceptions. This allows to catch different kinds of unhandled exceptions, signals, process abort and termination. As the result corresponding exception will be routed to the global exceptions handler function (default one will print the exception in std::cerr with a full stack-trace) and the dump file will be created.

Not thread-safe.

Definition at line 32 of file exceptions_handler.h.

Constructor & Destructor Documentation

◆ ExceptionsHandler() [1/2]

CppCommon::ExceptionsHandler::ExceptionsHandler ( const ExceptionsHandler )
delete

◆ ExceptionsHandler() [2/2]

CppCommon::ExceptionsHandler::ExceptionsHandler ( ExceptionsHandler &&  )
delete

◆ ~ExceptionsHandler()

CppCommon::ExceptionsHandler::~ExceptionsHandler ( )

Definition at line 650 of file exceptions_handler.cpp.

Member Function Documentation

◆ operator=() [1/2]

ExceptionsHandler& CppCommon::ExceptionsHandler::operator= ( const ExceptionsHandler )
delete

◆ operator=() [2/2]

ExceptionsHandler& CppCommon::ExceptionsHandler::operator= ( ExceptionsHandler &&  )
delete

◆ SetupHandler()

void CppCommon::ExceptionsHandler::SetupHandler ( const std::function< void(const SystemException &, const StackTrace &)> &  handler)
static

Setup new global exceptions handler function.

This method should be called once for the current process. It is recommended to call the method just after the current process start!

Parameters
handler- Exceptions handler function

Definition at line 656 of file exceptions_handler.cpp.

◆ SetupProcess()

void CppCommon::ExceptionsHandler::SetupProcess ( )
static

Setup exceptions handler for the current process.

This method should be called once for the current process. It is recommended to call the method just after the current process start!

Examples
errors_exceptions_handler.cpp, and threads_thread.cpp.

Definition at line 657 of file exceptions_handler.cpp.

◆ SetupThread()

void CppCommon::ExceptionsHandler::SetupThread ( )
static

Setup exceptions handler for the current thread.

This method should be called once for the current thread. It is recommended to call the method just after the current thread start!

Definition at line 658 of file exceptions_handler.cpp.


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