aboutsummaryrefslogtreecommitdiffstats
path: root/al/eax_utils.cpp
blob: 67389de42003ff7a073ed89cdf91570e097bf50f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "config.h"

#include "eax_utils.h"

#include <cassert>
#include <exception>

#include "core/logging.h"


void eax_log_exception(
    const char* message) noexcept
{
    const auto exception_ptr = std::current_exception();

    assert(exception_ptr);

    if (message)
    {
        ERR("%s\n", message);
    }

    try
    {
        std::rethrow_exception(exception_ptr);
    }
    catch (const std::exception& ex)
    {
        const auto ex_message = ex.what();
        ERR("%s\n", ex_message);
    }
    catch (...)
    {
        ERR("%s\n", "Generic exception.");
    }
}