upload tizen1.0 source
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Contact / JSContactRef.cpp
index f6cd766..e0aaacb 100755 (executable)
@@ -26,7 +26,6 @@
 #include <CommonsJavaScript/Validator.h>
 #include <Tizen/Common/JSTizenExceptionFactory.h>
 #include <Tizen/Common/JSTizenException.h>
-//#include <Tizen/Common/JSGlobalContextFactory.h>
 #include "ContactConverter.h"
 #include "JSContactRef.h"
 
@@ -164,7 +163,7 @@ JSObjectRef JSContactRef::constructor(JSContextRef context,
 {
        LogDebug("entered");
 
-//     AceSecurityStatus status = CONTACT_CHECK_ACCESS(controller->getContext(), CONTACT_FUNCTION_API_ADD);
+//     AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADD);
 //     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        JSContactRefPriv *priv = static_cast<JSContactRefPriv*>(JSObjectGetPrivate(constructor));
@@ -173,22 +172,20 @@ JSObjectRef JSContactRef::constructor(JSContextRef context,
        }
        JSContextRef gContext = priv->getContext();
 
-//     JSContextRef gContext = JSGlobalContextFactory::getInstance()->get();
-
        BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
        Try {
-               if (argumentCount != 2)
-                       ThrowMsg(InvalidArgumentException, "Wrong arguments count.");
+               if (argumentCount < 2)
+                       ThrowMsg(InvalidArgumentException, "2nd argument must be contact id");
 
                if (!JSValueIsString(gContext, arguments[0]))
-                               ThrowMsg(InvalidArgumentException, "1st argument is not string.");
+                       ThrowMsg(InvalidArgumentException, "1st argument must be address book id");
 
                if (!JSValueIsString(gContext, arguments[1]))
-                               ThrowMsg(InvalidArgumentException, "2nd argument is not string.");
+                       ThrowMsg(InvalidArgumentException, "2nd argument must be contact id");
 
        } Catch(Exception ) {
                LogError("Argument type mismatch : " << _rethrown_exception.GetMessage());
-               *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments");
+               *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Wrong arguments");
                return NULL;
        }