AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AFatalException Class Reference

An exception that thrown when non-c++ unhandled error occurs (i.e. access violation). More...

#include <AUI/Common/AFatalException.h>

Detailed Description

Note
AFatalException::setGlobalHandler is supported on all platforms, but translation to AFatalError is not as it uses compiler-specific flags and hacks. See Platform support for further info.

Translation to throwing AFatalException recovers the application from crashed state, providing you ability to handle such errors and continue normal application execution. However, still recommended to handle such errors with setGlobalHandler() to at least save user data.

Platform support#

Platform Translation to throwing AFatalException setGlobalHandler()
Windows MSVC +
Linux GCC +
macOS - +
Android GCC +
iOS - +

Member Function Documentation

> All members, including inherited

◆ address()

void * AFatalException::address ( ) const
inline
Returns
Address where does the fatal exception occurred.

◆ getMessage()

AString AFatalException::getMessage ( ) const
overridevirtualnoexcept

Reimplemented from AException.

◆ nativeSignalId()

int AFatalException::nativeSignalId ( ) const
inline
Returns
Native signal id.

◆ setGlobalHandler()

static void AFatalException::setGlobalHandler ( Handler globalHandler)
inlinestatic
Parameters
globalHandlerhandler

The handler is called inside OS's signal callback, thus, it's not recommended to use the following operations during callback execution:

  • I/O (printf, logging, fopen, fread, fwrite, etc...)
  • Heap routines (malloc, free, new, delete), including heap-based containers (std::vector, std::list, std::queue, etc...)
  • System calls (time, getcwd, etc...)

Basically, you may want to define global AOptional<AFatalException> and store the copy of exception in order to process it outside of the callback.

The callback may be used for handling and sending telemetry data (however, be aware of using unrecommended operations).

◆ signalName()

std::string_view AFatalException::signalName ( ) const
inline
Returns
Signal name.