11 typedef void ( *ExceptionActionPf ) (
const Exception& );
13 #define MAX_CONTEXT 128
14 #define G_EXCEPTION_UNDEF_CODE -1
29 static void do_FatalAction (
const Exception& );
30 static void default_FatalAction (
const Exception& );
32 static ExceptionActionPf get_ThreadFatalAction ( );
33 static void set_ThreadFatalAction ( ExceptionActionPf );
35 static void do_UnhandledExceptionHandling (
const Exception& ,
const char* thread_name );
36 static void do_UnhandledExceptionHandling (
const std::exception& ,
const char* thread_name );
37 static void do_UnhandledExceptionHandling (
const char* thread_name );
45 static void generic_ExceptionCancelHandling ( );
54 Context (
const char* context_str ,
const char* file =
"" ,
int line = -1 );
57 const std::string& getMethod ( )
const {
return mMethod; }
58 const std::string& getFile ( )
const {
return mFile; }
59 int getLine ( )
const {
return mLine; }
61 std::string getString ( )
const;
62 std::wstring getStringW ( )
const {
return to_Wstring ( getString ( ) ); }
78 void addContext (
const Context& );
79 int getSize ( )
const {
return mSize; }
81 std::wstring getStringW ( )
const {
return to_Wstring ( getString ( ) ); }
82 std::string getString ( )
const;
84 const Context& operator [] (
int index )
const;
90 Context mContextList[MAX_CONTEXT];
93 template <
class E_T >
static void raise_Helper ( E_T& aException );
94 template <
class E_T >
static void do_Raise (
const char* aContextStr ,
const char* aFile ,
int aLine );
95 template <
class E_T >
static void do_RaiseMsg (
const char* aMsg ,
const char* aContextStr ,
const char* aFile ,
int aLine );
96 template <
class E_T >
static void do_FatalAction (
const char* aMsg ,
const char* aContextStr ,
const char* aFile ,
int aLine ) { do_FatalAction ( E_T ( aMsg ,
Context(aContextStr,aFile,aLine) ) ); }
97 template <
class E_T >
static void do_Rethrow (
const E_T& aInnerExc ,
const char* aContextStr ,
const char* aFile ,
int aLine );
99 static ExceptionActionPf get_AlternateRaiseAction ( );
100 static void set_ThreadAlternateRaiseAction ( ExceptionActionPf );
102 void showMsg ( )
const;
103 void showFullMsg ( )
const;
104 const std::wstring& getErrorMsgW ( )
const {
return mMessage; }
105 const std::string getErrorMsg ( )
const {
return to_StdString(getErrorMsgW()); }
107 std::wstring getFullErrorMsgW ( )
const;
108 std::string getFullErrorMsg ( )
const {
return to_StdString(getFullErrorMsgW()); }
110 static const char* get_Tag ( ) {
return "Exception"; }
111 virtual const char* getTag ( )
const {
return Exception::get_Tag(); }
113 const std::wstring getTagW ( )
const {
return to_Wstring(getTag()); }
114 const ContextList& getContextList ( )
const {
return mContextList; }
117 GInt64_t getCode ( )
const {
return mCode; }
119 static void default_MsgShowAction (
const Exception& );
120 static void default_MsgFullShowAction (
const Exception& );
122 static ExceptionActionPf get_ThreadMsgShowAction ( );
123 static void set_ThreadMsgShowAction ( ExceptionActionPf );
125 static ExceptionActionPf get_ThreadMsgFullShowAction ( );
126 static void set_ThreadMsgFullShowAction ( ExceptionActionPf );
129 static ExceptionActionPf msg_showAction;
130 static ExceptionActionPf msg_fullShowAction;
133 static ExceptionActionPf fatal_ActionPf;
134 static ExceptionActionPf alternate_RaiseAction;
137 std::wstring mMessage;
139 ContextList mContextList;
147 static const char* get_Tag ( ) {
return "UnimplemetedException"; }
148 virtual const char* getTag ( )
const {
return get_Tag(); }
151 template <
class E_T >
void Exception::do_Rethrow (
const E_T& aInnerExc ,
const char* aContextStr ,
const char* aFile ,
int aLine )
153 E_T exception_instance ( aInnerExc , Context(aContextStr,aFile,aLine) );
154 Exception::raise_Helper ( exception_instance );
157 template <
class E_T >
void Exception::do_Raise (
const char* aContextStr ,
const char* aFile ,
int aLine )
160 Exception::raise_Helper ( exception_instance );
163 template <
class E_T >
void Exception::do_RaiseMsg (
const char* aMsg ,
const char* aContextStr ,
const char* aFile ,
int aLine )
166 Exception::raise_Helper ( exception_instance );
169 template <
class E_T >
void Exception::raise_Helper ( E_T& aException )
171 ExceptionActionPf thread_action_pf = get_AlternateRaiseAction ( );
173 if ( thread_action_pf != NULL )
175 ( *thread_action_pf ) ( aException );
Definition: g_Exception.h:50
Definition: g_Exception.h:70
Definition: g_Exception.h:142
#define G_EXC_DEFINE(aexctypename, abaseexctypename)
Definition: g_exception_macros.h:39
Definition: g.mthread.ThreadSimpleEvent.h:5
std::wstring to_Wstring(const std::string &aString)
Converts a string to a wide strings.
Definition: g_common_functions.h:83
Anchestor Exception class for g::lib.
Definition: g_Exception.h:17
std::string to_StdString(const std::wstring &aString)
std::wstring to std::string
Definition: g_common_functions.h:80