X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/a2ab0fd327b427d1f537cb7bc79de985fae3a0f5..b23692f3038296c94d25c84c55ed4c1bb49619cf:/Exception.hpp?ds=sidebyside diff --git a/Exception.hpp b/Exception.hpp index ff63b8c..dcc119b 100644 --- a/Exception.hpp +++ b/Exception.hpp @@ -35,13 +35,13 @@ class CYPool; -struct CYException { +struct _visible CYException { virtual ~CYException() { } virtual const char *PoolCString(CYPool &pool) const = 0; #ifdef CY_EXECUTE - virtual JSValueRef CastJSValue(JSContextRef context) const = 0; + virtual JSValueRef CastJSValue(JSContextRef context, const char *name) const = 0; #endif }; @@ -53,14 +53,16 @@ void CYThrow(JSContextRef context, JSValueRef value); #define CYTry \ try -#define CYCatch(value) \ +#define CYCatch_(value, name) \ catch (const CYException &error) { \ - *exception = error.CastJSValue(context); \ + *exception = error.CastJSValue(context, name); \ return value; \ } catch (...) { \ *exception = CYCastJSValue(context, "catch(...)"); \ return value; \ } +#define CYCatch(value) \ + CYCatch_(value, "Error") #define _assert_(mode, test, code, format, ...) do \ if (!(test)) \