AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
AFatalException.h
1/*
2 * AUI Framework - Declarative UI toolkit for modern C++20
3 * Copyright (C) 2020-2024 Alex2772 and Contributors
4 *
5 * SPDX-License-Identifier: MPL-2.0
6 *
7 * This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 */
11
12//
13// Created by alex2772 on 1/14/22.
14//
15
16#pragma once
17
18#include "AException.h"
19
40class API_AUI_CORE AFatalException: public AException {
41public:
42 using Handler = std::function<void(AFatalException*)>;
43
44 explicit AFatalException(std::string_view signalName, int nativeSignalId);
45
46 AString getMessage() const noexcept override;
47
51 void* address() const {
52 return mAddress;
53 }
54
58 int nativeSignalId() const {
59 return mNativeSignalId;
60 }
61
65 std::string_view signalName() const {
66 return mSignalName;
67 }
68
87 static void setGlobalHandler(Handler globalHandler) {
88 handler() = std::move(globalHandler);
89 }
90
91private:
92 void* mAddress;
93 std::string_view mSignalName;
94 int mNativeSignalId;
95
96 static Handler& handler();
97};
Abstract AUI exception.
Definition: AException.h:29
An exception that thrown when non-c++ unhandled error occurs (i.e. access violation).
Definition: AFatalException.h:40
static void setGlobalHandler(Handler globalHandler)
Sets handler for fatal exceptions.
Definition: AFatalException.h:87
int nativeSignalId() const
Definition: AFatalException.h:58
std::string_view signalName() const
Definition: AFatalException.h:65
void * address() const
Definition: AFatalException.h:51
Represents a Unicode character string.
Definition: AString.h:37