Update change log and spec for wrt-plugins-tizen_0.4.59
[framework/web/wrt-plugins-tizen.git] / src / Calendar / JSCalendarRecurrenceRule.cpp
index b1349f4..56332d3 100755 (executable)
@@ -153,31 +153,28 @@ JSObjectRef DLL_EXPORT JSCalendarRecurrenceRule::constructor(JSContextRef contex
     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])));
@@ -188,23 +185,25 @@ JSObjectRef DLL_EXPORT JSCalendarRecurrenceRule::constructor(JSContextRef contex
     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,