X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/a1ae298586df883c0247ee2481fa58caa6a4c756..3cc3e14d8539cef545aa57f3b1a3499c0d3fdf1b:/Exception.hpp diff --git a/Exception.hpp b/Exception.hpp index dcc119b..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)) \ @@ -107,9 +111,10 @@ static _finline bool CYContains(int value, size_t many, const int *okay) { #define _sqlcall(expr) ({ \ __typeof__(expr) _value = (expr); \ - _assert_("sqlcall", _value == 0 || _value >= 100 && _value < 200, #expr, " %u:%s", _value sqlite3_errmsg(database_)); \ -}) + _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*/