Go to the documentation of this file.
11 #define G_EXC_DEFINE_TAG(aexctypename,abaseexctypename,atag) \
13 class aexctypename : public abaseexctypename {\
15 aexctypename ( const std::wstring& msg , const Context& context ):abaseexctypename(msg,context){}\
16 aexctypename ( const std::string& msg , const Context& context ):abaseexctypename(msg,context){}\
17 aexctypename ( const Exception& inner , const Context& context ):abaseexctypename(inner,context){}\
18 virtual ~aexctypename (){}\
19 static const char* get_Tag ( ) { return atag; }\
20 virtual const char* getTag ( ) const { return get_Tag(); }\
24 #define G_EXC_DEFINE_TAG_MSG(aexctypename,abaseexctypename,atag,amsg) \
25 class aexctypename : public abaseexctypename {\
27 aexctypename ( const std::wstring& msg , const Context& context ):abaseexctypename(msg,context){}\
28 aexctypename ( const std::string& msg , const Context& context ):abaseexctypename(msg,context){}\
29 aexctypename ( const Context& context ):abaseexctypename(G_STR(amsg),context){}\
30 aexctypename ( const Exception& inner , const Context& context ):abaseexctypename(inner,context){}\
31 virtual ~aexctypename (){}\
32 static const char* get_Tag ( ) { return atag; }\
33 virtual const char* getTag ( ) const { return get_Tag(); }\
39 #define G_EXC_DEFINE(aexctypename,abaseexctypename) G_EXC_DEFINE_TAG ( aexctypename , abaseexctypename , G_STR (aexctypename) )
43 #define G_EXC_DEFINE_MSG(aexctypename,abaseexctypename,amsg) G_EXC_DEFINE_TAG_MSG ( aexctypename , abaseexctypename , G_STR (aexctypename) , amsg )
46 #define G_ASSERT(acondition) if(!(acondition)){ g::AssertException::do_FatalAction<g::Exception> ( "ASSERTION FAILED:\r\n" G_STR(acondition) , G_EXC_SIGNATURE() ); }
52 #define G_EXC_SET_CONTEXT(acontextstr) static const char* _g_method_context = acontextstr;
55 #define G_EXC_SIGNATURE() _g_method_context , __FILE__ , __LINE__
58 #define G_EXC_RAISE_MSG(aexctype,amessage) g::Exception::do_RaiseMsg<aexctype> ( amessage , G_EXC_SIGNATURE() )
61 #define G_EXC_RAISE(aexctype) g::Exception::do_Raise<aexctype> ( G_EXC_SIGNATURE() )
64 #define G_EXC_FATAL_ACTION(amessage) g::Exception::do_FatalAction<g::Exception> ( amessage , G_EXC_SIGNATURE() );
66 #if G_AUTOPTION_ON_WINDOWS
67 # define G_EXC_RAISE_WIN() g::WinException::do_Raise ( _g_sys_call , G_EXC_SIGNATURE() )
81 #define G_SYS_CALL_ONLY(acall) GInt64_t _g_sys_result = (GInt64_t)( acall );static const char* _g_sys_call = G_STR(acall)
86 #define G_WIN_CALL_ASSERT(awincall,acondition) G_SYS_CALL_ONLY(awincall); if( !(acondition) ){ G_EXC_RAISE_WIN(); }
91 #define G_WIN_CALL(awincall) G_WIN_CALL_ASSERT( awincall , (_g_sys_result) )
94 #define G_EXC_RAISE_POSIX() g::PosixException::do_Raise ( _g_sys_result , _g_sys_call , G_EXC_SIGNATURE() )
99 #define G_POSIX_CALL_ASSERT(aposixcall,acondition) G_SYS_CALL_ONLY(aposixcall);if ( !(acondition) ) { G_EXC_RAISE_POSIX(); }
104 #define G_POSIX_CALL(aposixcall) G_POSIX_CALL_ASSERT(aposixcall,(_g_sys_result==0))
109 #define G_POSIX_CALL_VALUE(aposixcall) G_POSIX_CALL_ASSERT(aposixcall,(_g_sys_result!=-1))
112 #define G_EXC_FRAME_BEGIN() try{
127 #define G_EXC_FRAME_END_THREAD(athreadname) \
128 } catch ( g::Exception& exc ) { g::Exception::do_UnhandledExceptionHandling ( exc , athreadname ); }\
129 catch ( std::exception& exc ) { g::Exception::do_UnhandledExceptionHandling ( exc , athreadname ); }\
130 catch ( ... ) { g::Exception::generic_ExceptionCancelHandling();g::Exception::do_UnhandledExceptionHandling ( athreadname ); }
133 #define G_EXC_FRAME_END_MAIN() G_EXC_FRAME_END_THREAD ( "MainThread" )
137 #define G_EXC_UNIMPLEMENTED(acontextstr) G_EXC_SET_CONTEXT(acontextstr); G_EXC_RAISE ( g::UnimplemetedException )
140 #define G_EXC_FRAME_FILTER_RETHROW(afilterexc) } catch ( afilterexc& exc ) { g::Exception::do_Rethrow<afilterexc> ( exc , G_EXC_SIGNATURE() ); }