Print more info when exception occurred
This commit is contained in:
parent
a2e3a1ea8c
commit
7cfccdbf3c
|
|
@ -20,19 +20,22 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/Common.h>
|
#include <kiwano/core/Common.h>
|
||||||
|
#include <kiwano/core/Logger.h>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
#define KGE_THROW(MESSAGE) \
|
#define KGE_THROW(MESSAGE) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
kiwano::StackTracer().Print(); \
|
KGE_ERROR("An exception occurred: %s", MESSAGE); \
|
||||||
throw kiwano::RuntimeError(MESSAGE); \
|
kiwano::StackTracer().Print(); \
|
||||||
|
throw kiwano::RuntimeError(MESSAGE); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define KGE_THROW_SYSTEM_ERROR(ERRCODE, MESSAGE) \
|
#define KGE_THROW_SYSTEM_ERROR(ERRCODE, MESSAGE) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
|
KGE_ERROR("An exception occurred (%#x): %s", ERRCODE, MESSAGE); \
|
||||||
kiwano::StackTracer().Print(); \
|
kiwano::StackTracer().Print(); \
|
||||||
throw kiwano::SystemError(std::error_code(kiwano::error_enum(ERRCODE)), MESSAGE); \
|
throw kiwano::SystemError(std::error_code(kiwano::error_enum(ERRCODE)), MESSAGE); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue