Skip to content

AFatalException#

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

Header:#include <AUI/Common/AFatalException.h>
CMake:aui_link(my_target PUBLIC aui::core)

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 - +

Public Methods#

address#


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

nativeSignalId#


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

setGlobalHandler#


static void AFatalException::setGlobalHandler(Handler globalHandler)

Sets handler for fatal exceptions.

Arguments
globalHandler
handler

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()
Returns
Signal name.