From 1eeb7e57bf949a0198dddb0eb734c36eed82f59b Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 9 Jan 2014 23:01:53 -0800 Subject: [PATCH] Support @error when CYONifying JavaScript arrays. --- Execute.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Execute.cpp b/Execute.cpp index 139aada..e118146 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -451,18 +451,21 @@ static JSValueRef Array_callAsFunction_toCYON(JSContextRef context, JSObjectRef bool comma(false); for (size_t index(0), count(CYCastDouble(context, length)); index != count; ++index) { - JSValueRef value(CYGetProperty(context, _this, index)); - if (comma) str << ','; else comma = true; - if (!JSValueIsUndefined(context, value)) - str << CYPoolCCYON(pool, context, value); - else { - str << ','; - comma = false; + try { + JSValueRef value(CYGetProperty(context, _this, index)); + if (!JSValueIsUndefined(context, value)) + str << CYPoolCCYON(pool, context, value); + else { + str << ','; + comma = false; + } + } catch (const CYException &error) { + str << "@error"; } } -- 2.49.0