mirror of https://gitee.com/bigwinds/arangodb
improve Exceptionhandling
- add backtraces - derive public from std::exception so the usual catch to these kicks in.
This commit is contained in:
parent
5bcc8d784f
commit
e65a53475b
|
@ -51,6 +51,13 @@ TriagensError::TriagensError (string const& type, string const& details, char co
|
||||||
if (! details.empty()) {
|
if (! details.empty()) {
|
||||||
_message += " details = '" + _details + "'";
|
_message += " details = '" + _details + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TRI_ENABLE_MAINTAINER_MODE
|
||||||
|
#if HAVE_BACKTRACE
|
||||||
|
_backtrace();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -285,12 +285,22 @@ namespace triagens {
|
||||||
/// @brief JsonException, an exception class for the Json class
|
/// @brief JsonException, an exception class for the Json class
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class JsonException : std::exception {
|
class JsonException : public virtual std::exception {
|
||||||
std::string _msg;
|
std::string _msg;
|
||||||
public:
|
public:
|
||||||
JsonException () : _msg("Json exception") {
|
JsonException () : _msg("Json exception") {
|
||||||
|
#ifdef TRI_ENABLE_MAINTAINER_MODE
|
||||||
|
#if HAVE_BACKTRACE
|
||||||
|
_backtrace();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
JsonException (string msg) : _msg(msg) {
|
JsonException (string msg) : _msg(msg) {
|
||||||
|
#ifdef TRI_ENABLE_MAINTAINER_MODE
|
||||||
|
#if HAVE_BACKTRACE
|
||||||
|
_backtrace();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
char const* what () const throw() {
|
char const* what () const throw() {
|
||||||
return _msg.c_str();
|
return _msg.c_str();
|
||||||
|
|
Loading…
Reference in New Issue