const JSValueRef arguments[],
JSValueRef* exception)
{
+ EventRecurrenceRulePtr rrule( new EventRecurrenceRule());
+
Try
{
JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
CalendarConverter converter(globalContext);
- EventRecurrenceRulePtr rrule;
if (argumentCount==0) {
- EventRecurrenceRulePtr result( new EventRecurrenceRule());
- rrule = result;
+ LoggerD("No arguments provided.");
} else if (argumentCount==1) {
- EventRecurrenceRulePtr result( new EventRecurrenceRule());
- rrule = result;
rrule->setFrequency(converter.toRecurrenceFrequency(converter.toString(arguments[0])));
} else if (argumentCount>=2) {
if (JSValueIsNull(context, arguments[1]) || JSValueIsUndefined(context, arguments[1])) {
- EventRecurrenceRulePtr result( new EventRecurrenceRule());
- rrule = result;
+ LoggerD("Null or undefined case.");
} else {
- if (!JSValueIsObject(context, arguments[1])) {
- ThrowMsg(ConversionException, "Wrong second parameter type.");
- }
-
- rrule = converter.toEventRecurrenceRule(arguments[1]);
- if (!rrule) {
- ThrowMsg(ConversionException, "Parameter conversion failed.");
+ if (JSValueIsObject(context, arguments[1])) {
+ rrule = converter.toEventRecurrenceRule(arguments[1]);
+ if (!rrule) {
+ ThrowMsg(ConversionException, "Parameter conversion failed.");
+ }
+ } else {
+ //ThrowMsg(ConversionException, "Wrong second parameter type.");
}
}
rrule->setFrequency(converter.toRecurrenceFrequency(converter.toString(arguments[0])));
Catch(UnsupportedException)
{
LoggerW("Exception: "<<_rethrown_exception.GetMessage());
- return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
+ //return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
LoggerW("Exception: "<<_rethrown_exception.GetMessage());
- return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
+ //return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
LoggerW("Exception: "<<_rethrown_exception.GetMessage());
- return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
+ //return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
LoggerW("Exception: "<<_rethrown_exception.GetMessage());
- return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
+ //return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
+
+ return createJSCalendarRecurrenceRule(context, rrule);
}
JSValueRef JSCalendarRecurrenceRule::getProperty(JSContextRef context,