X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/8d20f0f1540c4c116f52e333edc57a4f549927e8..1e8d80477a3e058a30c477955f1e0c56deb6e956:/Exception.hpp diff --git a/Exception.hpp b/Exception.hpp index 3b5b6b7..1efaf3f 100644 --- a/Exception.hpp +++ b/Exception.hpp @@ -1,5 +1,5 @@ -/* Cycript - Optimizing JavaScript Compiler/Runtime - * Copyright (C) 2009-2015 Jay Freeman (saurik) +/* Cycript - The Truly Universal Scripting Language + * Copyright (C) 2009-2016 Jay Freeman (saurik) */ /* GNU Affero General Public License, Version 3 {{{ */ @@ -56,13 +56,17 @@ void CYThrow(JSContextRef context, JSValueRef value); #define CYCatch_(value, name) \ catch (const CYException &error) { \ *exception = error.CastJSValue(context, name); \ + _assert(*exception != NULL); \ return value; \ } catch (...) { \ *exception = CYCastJSValue(context, "catch(...)"); \ + _assert(*exception != NULL); \ return value; \ } #define CYCatch(value) \ CYCatch_(value, "Error") +#define CYCatchObject() \ + CYCatch(JSObjectMake(context, NULL, NULL)) #define _assert_(mode, test, code, format, ...) do \ if (!(test)) \ @@ -110,6 +114,7 @@ static _finline bool CYContains(int value, size_t many, const int *okay) { _assert_("sqlcall", _value == 0 || _value >= 100 && _value < 200, #expr, " %u:%s", _value, sqlite3_errmsg(database_)); \ _value; }) +#ifdef CY_EXECUTE struct CYJSException { JSContextRef context_; JSValueRef value_; @@ -133,5 +138,6 @@ struct CYJSException { CYJSException _error(context); \ (code)(args, _error); \ }) +#endif #endif/*CYCRIPT_ERROR_HPP*/