#define IF_FAIL_CATCH(cond) \
do { if (!(cond)) { goto CATCH; } } while (0)
-#define IS_FAILED(X) ((X) != ERR_NONE)
+#define IF_FAIL_THROW_TAG(cond, excp, tag, fmt, arg...) \
+ do { if (!(cond)) { tag(fmt, ##arg); throw excp; } } while (0)
+
+#define IF_FAIL_THROW(cond, excp) \
+ do { if (!(cond)) { throw excp; } } while (0)
+
+#define IS_FAILED(X) ((X) < 0)
+
+#define IS_SUCCESS(X) ((X) >= 0)
#define HANDLE_GERROR(Err) \
do { if ((Err)) { _E("GError: %s", Err->message); g_error_free(Err); Err = NULL; } } while (0)