]> git.saurik.com Git - cycript.git/blobdiff - Exception.hpp
Cache crazy dlopen/dladdr library path gymnastics.
[cycript.git] / Exception.hpp
index 0282f0f77a230b5b8f1a89ecf455423d4d9a6d1b..dcc119b29f5e17aa1d55b8e927f44757a7cbf411 100644 (file)
 
 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)) \
@@ -78,7 +80,7 @@ while (false)
 _value; })
 
 #define _trace() do { \
-    fprintf(stderr, "_trace():%u\n", __LINE__); \
+    fprintf(stderr, "_trace(%s:%u)\n", __FILE__, __LINE__); \
 } while (false)
 
 static _finline bool CYContains(int value, size_t many, const int *okay) {