upload tizen1.0 source
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Bluetooth / JSBluetoothClass.cpp
index 03ea433..c4e27e2 100644 (file)
@@ -181,7 +181,7 @@ JSValueRef JSBluetoothClass::getProperty(JSContextRef context,
        {
                if (priv == NULL)
                {
-                       Throw(WrtDeviceApis::Commons::InvalidArgumentException);
+                       Throw(WrtDeviceApis::Commons::ConversionException);
                }
 
                BluetoothClassPtr btClass(priv->getObject());
@@ -239,26 +239,24 @@ JSValueRef JSBluetoothClass::hasService(JSContextRef context, JSObjectRef object
 
 {
        JSBluetoothClassPriv* priv = static_cast<JSBluetoothClassPriv*>(JSObjectGetPrivate(thisObject));        
-       
+       JSValueRef reserveArgument = JSValueMakeUndefined(context);
+
        try 
        {
                if (priv == NULL)
                {
                        LogError("priv null");
 
-                       Throw(WrtDeviceApis::Commons::UnknownException);
+                       Throw(WrtDeviceApis::Commons::ConversionException);
                }
 
-               if (argumentCount != 1 || JSValueIsNull(context, arguments[0]) == true 
-                       || JSValueIsNumber(context, arguments[0]) == false)
+               if (argumentCount >= 1)
                {
-                       LogError("argument fail");
-                       Throw(WrtDeviceApis::Commons::InvalidArgumentException);
+                       reserveArgument = arguments[0];
                }
 
                
                AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(
-                               priv->getContext(),
                                bluetoothExportedNames[BLUETOOTH_FUNCTION_API_BLUETOOTHCLASS_HAS_SERVICE]);
 
                TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -285,6 +283,12 @@ JSValueRef JSBluetoothClass::hasService(JSContextRef context, JSObjectRef object
                return JSTizenExceptionFactory::postException(context, exception, 
                        JSTizenException::INVALID_VALUES_ERROR, "invalid parameter error");     
        }       
+       Catch (WrtDeviceApis::Commons::ConversionException) 
+       {
+               LogError("TypemismatchException");
+               return JSTizenExceptionFactory::postException(context, exception, 
+                       JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");  
+       }       
        Catch (WrtDeviceApis::Commons::SecurityException) 
        {
                LogError("permission denied error");