LeechCraft 0.6.70-19214-g121e5318a7
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
exceptions.cpp
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#include "exceptions.h"
10#include <exception>
11#if __has_include(<cxxabi.h>)
12#include <cxxabi.h>
13#define LC_HAS_CXA_CURRENT_EXCEPTION_TYPE
14#endif
15#include <QString>
16#include "demangle.h"
17#include "qtutil.h"
18
19namespace LC::Util
20{
22 {
23 try
24 {
25 throw;
26 }
27 catch (const std::exception& e)
28 {
29 return QString::fromUtf8 (e.what ());
30 }
31 catch (...)
32 {
33#ifdef LC_HAS_CXA_CURRENT_EXCEPTION_TYPE
34 if (const auto type = abi::__cxa_current_exception_type ())
35 return "exception of type "_qs + Demangle (*type);
36#endif
37 return "unknown exception"_qs;
38 }
39 }
40}
QString DescribeCurrentException()
Describes the exception currently being handled.
QString Demangle(const char *name)
Returns a human-readable form of a mangled symbol name.
Definition demangle.cpp:20