HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
Heph::Exception Class Reference

stores exception information. Base class for exceptions. More...

#include <Exception.h>

Inheritance diagram for Heph::Exception:
Heph::ExternalException Heph::InsufficientMemoryException Heph::InvalidArgumentException Heph::InvalidOperationException Heph::NotFoundException Heph::NotImplementedException Heph::NotSupportedException Heph::TimeoutException

Public Member Functions

 Exception ()
 
 Exception (const std::string &method, const std::string &message)
 
virtual ~Exception ()=default
 
virtual const char * what () const noexcept override
 
virtual std::string GetName () const
 
virtual const std::string & GetMethod () const
 
virtual const std::string & GetMessage () const
 
virtual void Raise (const void *pSender) const
 

Static Public Member Functions

static std::shared_ptr< ExceptionGetLastException () noexcept
 
static std::vector< std::shared_ptr< Exception > > & GetExceptions () noexcept
 
static void DefaultHandler (const EventParams &params)
 

Static Public Attributes

static Event OnException = Event()
 

Protected Member Functions

virtual void AddToExceptions () const
 

Protected Attributes

std::string method
 
std::string message
 

Detailed Description

stores exception information. Base class for exceptions.

Constructor & Destructor Documentation

◆ Exception() [1/2]

Heph::Exception::Exception ( )

creates a new instance and initializes it with default values.

◆ Exception() [2/2]

Heph::Exception::Exception ( const std::string & method,
const std::string & message )

creates a new instance and initializes it with the provided values.

Parameters
methodname of the method where the exception occurred.
messagedescription of the exception.

◆ ~Exception()

virtual Heph::Exception::~Exception ( )
virtualdefault

releases the resources and destroys the instance.

Member Function Documentation

◆ GetName()

virtual std::string Heph::Exception::GetName ( ) const
virtual

◆ GetMethod()

virtual const std::string & Heph::Exception::GetMethod ( ) const
virtual

gets the method.

◆ GetMessage()

virtual const std::string & Heph::Exception::GetMessage ( ) const
virtual

gets the message.

◆ Raise()

virtual void Heph::Exception::Raise ( const void * pSender) const
virtual

raises the OnException event.

Parameters
pSenderpointer to the object instance that caused the exception.

◆ AddToExceptions()

virtual void Heph::Exception::AddToExceptions ( ) const
protectedvirtual

◆ GetLastException()

static std::shared_ptr< Exception > Heph::Exception::GetLastException ( )
staticnoexcept

gets the last exception, or nullptr if no exception raised.

◆ GetExceptions()

static std::vector< std::shared_ptr< Exception > > & Heph::Exception::GetExceptions ( )
staticnoexcept

gets the exceptions that occurred in the current thread.

◆ DefaultHandler()

static void Heph::Exception::DefaultHandler ( const EventParams & params)
static

the default handler for the OnException event.

Member Data Documentation

◆ OnException

Event Heph::Exception::OnException = Event()
inlinestatic

raised when an exception occurs.

◆ method

std::string Heph::Exception::method
protected

name of the method where the exception occurred.

◆ message

std::string Heph::Exception::message
protected

description of the exception.