2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 #include <CommonsJavaScript/Validator.h>
20 #include <CommonsJavaScript/JSUtils.h>
21 #include <CommonsJavaScript/JSCallbackManager.h>
22 #include <CommonsJavaScript/Utils.h>
23 #include <FilterConverter.h>
24 #include "EventFindCallHistory.h"
25 #include "EventRemoveBatch.h"
26 #include "EventRemoveAll.h"
27 #include "EventCallHistoryListener.h"
28 #include "CallHistoryFactory.h"
29 #include "ICallHistory.h"
30 #include <JSTizenExceptionFactory.h>
31 #include <JSTizenException.h>
32 #include <SecurityExceptions.h>
34 #include <JSWebAPIError.h>
35 #include <ArgumentValidator.h>
36 #include <TimeTracer.h>
39 #include "JSCallHistoryEntry.h"
40 #include "JSCallHistory.h"
41 #include "CallHistoryStaticController.h"
42 #include "CallHistoryMultiCallback.h"
43 #include "ResponseDispatcher.h"
44 #include "Converter.h"
45 #include "plugin_config.h"
46 #include "CallHistoryAsyncCallbackManager.h"
47 #include "CallHistoryListenerManager.h"
48 #include "CallHistoryFilterConverter.h"
53 using namespace WrtDeviceApis::Commons;
54 using namespace WrtDeviceApis::CommonsJavaScript;
55 using namespace DeviceAPI::Tizen;
56 using namespace DeviceAPI::Common;
59 namespace CallHistory {
62 JSClassRef JSCallHistory::m_jsClassRef = NULL;
64 JSClassDefinition JSCallHistory::m_classInfo =
67 kJSClassAttributeNone,
85 JSStaticValue JSCallHistory::m_property[] = {
89 JSStaticFunction JSCallHistory::m_function[] =
91 { "find", JSCallHistory::find, kJSPropertyAttributeNone },
92 { "remove", JSCallHistory::remove, kJSPropertyAttributeNone },
93 { "removeBatch", JSCallHistory::removeBatch, kJSPropertyAttributeNone },
94 { "removeAll", JSCallHistory::removeAll, kJSPropertyAttributeNone },
95 { "addChangeListener", JSCallHistory::addChangeListener, kJSPropertyAttributeNone },
96 { "removeChangeListener", JSCallHistory::removeChangeListener, kJSPropertyAttributeNone },
100 const JSClassRef JSCallHistory::getClassRef() {
102 m_jsClassRef = JSClassCreate(&m_classInfo);
107 const JSClassDefinition* JSCallHistory::getClassInfo(){
111 void JSCallHistory::initialize(JSContextRef context, JSObjectRef object) {
112 JSCallHistoryPriv* priv = static_cast<JSCallHistoryPriv*>(JSObjectGetPrivate(object));
115 ICallHistoryPtr CallHistory(CallHistoryFactory::getInstance().getCallHistoryObject());
116 priv = new JSCallHistoryPriv(context, CallHistory);
117 if(!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
123 void JSCallHistory::finalize(JSObjectRef object) {
124 JSCallHistoryPriv* priv = static_cast<JSCallHistoryPriv*>(JSObjectGetPrivate(object));
126 JSObjectSetPrivate(object, NULL);
131 JSObjectRef JSCallHistory::createJSObject(JSContextRef context, JSObjectRef object)
133 ICallHistoryPtr CallHistory(CallHistoryFactory::getInstance().getCallHistoryObject());
134 JSCallHistoryPriv* priv = new JSCallHistoryPriv(context, CallHistory);
136 return JSObjectMake(context, getClassRef(), priv);
139 bool JSCallHistory::hasInstance(JSContextRef context, JSObjectRef constructor,
140 JSValueRef possibleInstance, JSValueRef* exception) {
141 return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
144 JSValueRef JSCallHistory::find(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
145 const JSValueRef arguments[], JSValueRef* exception) {
146 TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
147 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
148 CALL_HISTORY_FUNCTION_API_FIND);
150 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
152 bool bSuccess = false;
155 if (argumentCount < 1) {
156 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
159 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
162 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
165 JSContextRef gContext = priv->getContext();
166 WrtDeviceApis::CommonsJavaScript::Converter converter(context);
167 Validator check(context, exception);
169 JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
173 ArgumentValidator validator(context, argumentCount, arguments);
175 JSObjectRef successCB = validator.toFunction(0);
179 JSObjectRef errCB = validator.toFunction(1, true);
183 unsigned long limit = validator.toULong(4, true);
184 unsigned long offset = validator.toULong(5, true);
186 if (argumentCount >= 1) {
187 if (JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0])) {
188 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : success callback ");
189 } else if (!JSObjectIsFunction(context, converter.toJSObjectRef(arguments[0]))) {
190 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : success callback ");
192 cbm->setOnSuccess(arguments[0]);
195 if (argumentCount >= 2) {
196 if (!JSValueIsNull(context, arguments[1]) && !JSValueIsUndefined(context, arguments[1])) {
197 if (!JSObjectIsFunction(context, converter.toJSObjectRef(arguments[1]))) {
198 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : error callback ");
200 cbm->setOnError(arguments[1]);
204 if (argumentCount >= 3) {
205 if (!JSValueIsNull(context, arguments[2]) && !JSValueIsUndefined(context, arguments[2])) {
206 if (!JSValueIsObject(context, arguments[2])) {
207 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : filter");
212 cbm->setObject(thisObject);
214 CallHistoryFilterConverterFactory::ConverterType filterConverter =
215 CallHistoryFilterConverterFactory::getConverter(context);
217 EventFindCallHistoryPtr event(new EventFindCallHistory());
218 ICallHistoryPtr callHistory(priv->getObject());
220 event->setPrivateData(StaticPointerCast<IEventPrivateData> (cbm));
221 event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
223 if (argumentCount >= 3) {
224 if(!JSValueIsNull(context, arguments[2])){
225 FilterPtr filter = filterConverter->toFilter(arguments[2]);
228 throw DeviceAPI::Common::TypeMismatchException("Invalid Filter");
230 event ->setFilter(filter);
232 }else if(JSValueIsUndefined(context, arguments[2])) {
233 throw DeviceAPI::Common::TypeMismatchException("Filter is undefined");
237 if (argumentCount >= 4) {
238 if (!JSValueIsNull(context, arguments[3])) {
239 DeviceAPI::Tizen::SortModePtr sortMode = filterConverter->toSortMode(arguments[3]);
241 if(sortMode == NULL){
242 throw DeviceAPI::Common::TypeMismatchException("Invalid Sortmode");
244 event->setSortMode(filterConverter->toSortMode(arguments[3]));
246 }else if(JSValueIsUndefined(context, arguments[3])) {
247 throw DeviceAPI::Common::TypeMismatchException("Sortmode is undefined");
251 event->setLimit(limit);
252 event->setOffset(offset);
254 callHistory->find(event);
255 CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
256 } catch(const BasePlatformException& err){
257 return JSWebAPIError::throwException(context, exception, err);
258 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
259 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
260 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
261 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage()));
262 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
263 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
264 } catch(const WrtDeviceApis::Commons::Exception& ex) {
265 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
268 TIME_TRACER_ITEM_END(__FUNCTION__, 0);
269 return JSValueMakeUndefined(context);
272 JSValueRef JSCallHistory::remove(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
273 const JSValueRef arguments[], JSValueRef* exception) {
275 TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
276 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
277 CALL_HISTORY_FUNCTION_API_REMOVE);
279 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
282 ArgumentValidator validator(context, argumentCount, arguments);
284 JSObjectRef entryObj = validator.toObject(0);
286 if (argumentCount < 1) {
287 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
290 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
293 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
296 Converter converter(context);
298 if (!JSValueIsObjectOfClass(context, arguments[0], JSCallHistoryEntry::getClassRef())) {
299 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : CallHistoryEntry");
302 ICallHistoryPtr callHistory(priv->getObject());
303 if(entryObj != NULL){
304 CallHistoryEntryPropertiesPtr entry = converter.toCallHistoryEntryProperties(entryObj);
305 callHistory->remove(entry->getEntryId());
307 } catch(const BasePlatformException& err){
308 return JSWebAPIError::throwException(context, exception, err);
309 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
310 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
311 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
312 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage());
313 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
314 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
315 } catch(const WrtDeviceApis::Commons::Exception& ex) {
316 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
319 TIME_TRACER_ITEM_END(__FUNCTION__, 0);
320 return JSValueMakeUndefined(context);
323 JSValueRef JSCallHistory::removeBatch(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
324 const JSValueRef arguments[], JSValueRef* exception) {
326 TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
327 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
328 CALL_HISTORY_FUNCTION_API_REMOVE_BATCH);
330 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
332 if (argumentCount < 1) {
333 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
336 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
339 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
342 JSContextRef gContext = priv->getContext();
343 Converter converter(context);
345 JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
348 ArgumentValidator validator(context, argumentCount, arguments);
350 JSObjectRef entryObj = validator.toObject(0);
351 JSObjectRef successCB = validator.toFunction(1, true);
352 JSObjectRef errCB = validator.toFunction(2, true);
354 if(successCB != NULL)
355 cbm->setOnSuccess(arguments[1]);
358 cbm->setOnError(arguments[2]);
360 cbm->setObject(thisObject);
362 EventRemoveBatchPtr event(new EventRemoveBatch());
363 ICallHistoryPtr callHistory(priv->getObject());
365 event->setPrivateData(StaticPointerCast<IEventPrivateData> (cbm));
366 event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
368 CallHistoryEntryList entryList;
370 entryList = converter.toVectorOfCallHistoryEntryProperties(entryObj);
372 std::vector<unsigned long> entryIds;
374 if (entryList.size() > 0) {
375 for (unsigned int i = 0; i < entryList.size(); i++) {
376 entryIds.push_back(entryList[i]->getEntryId());
378 event->setEntryIds(entryIds);
379 callHistory->removeBatch(event);
380 CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
382 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error : Entry array is empty"));
384 } catch(const BasePlatformException& err){
385 return JSWebAPIError::throwException(context, exception, err);
386 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
387 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
388 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
389 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage()));
390 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
391 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
392 } catch(const WrtDeviceApis::Commons::Exception& ex) {
393 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
396 TIME_TRACER_ITEM_END(__FUNCTION__, 0);
397 return JSValueMakeUndefined(context);
400 JSValueRef JSCallHistory::removeAll(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
401 const JSValueRef arguments[], JSValueRef* exception) {
403 TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
404 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
405 CALL_HISTORY_FUNCTION_API_REMOVE_ALL);
407 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
409 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
412 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
415 JSContextRef gContext = priv->getContext();
416 Converter converter(context);
418 JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
421 ArgumentValidator validator(context, argumentCount, arguments);
423 JSObjectRef successCB = validator.toFunction(0, true);
424 JSObjectRef errCB = validator.toFunction(1, true);
426 if(successCB != NULL)
427 cbm->setOnSuccess(successCB);
429 cbm->setOnError(errCB);
431 cbm->setObject(thisObject);
432 EventRemoveAllPtr event(new EventRemoveAll());
433 ICallHistoryPtr callHistory(priv->getObject());
435 event->setPrivateData(StaticPointerCast<IEventPrivateData> (cbm));
436 event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
437 callHistory->removeAll(event);
438 CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
439 } catch(const BasePlatformException& err){
440 return JSWebAPIError::throwException(context, exception, err);
441 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
442 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
443 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
444 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage()));
445 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
446 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
447 } catch(const WrtDeviceApis::Commons::Exception& ex) {
448 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
451 TIME_TRACER_ITEM_END(__FUNCTION__, 0);
452 return JSValueMakeUndefined(context);
455 JSValueRef JSCallHistory::deleteRecording(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
456 const JSValueRef arguments[], JSValueRef* exception) {
458 return JSValueMakeUndefined(context);
461 JSValueRef JSCallHistory::addChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
462 const JSValueRef arguments[], JSValueRef* exception) {
464 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
465 CALL_HISTORY_FUNCTION_API_ADDLISTENER);
467 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
470 ArgumentValidator validator(context, argumentCount, arguments);
472 JSObjectRef observerObj = validator.toCallbackObject(0, false,"onadded","onchanged","onremoved",NULL);
474 if (argumentCount < 1) {
475 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
478 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
481 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
484 JSContextRef gContext = priv->getContext();
485 Converter converter(context);
488 if (argumentCount >= 1) {
489 EventCallHistoryListenerPrivateDataPtr privData(converter.toEventCallHistoryListenerPrivateData(observerObj, gContext));
491 EventCallHistoryListenerEmitterPtr emitter(new EventCallHistoryListenerEmitter);
492 emitter->setListener(&CallHistoryStaticController::getInstance());
493 emitter->setEventPrivateData(DPL::StaticPointerCast<EventCallHistoryListener::PrivateDataType>(privData));
495 ICallHistoryPtr callHistory(priv->getObject());
496 id = callHistory->addListener(emitter);
498 CallHistoryListenerCancellerPtr canceller = CallHistoryListenerCancellerPtr(new CallHistoryListenerCanceller(gContext, thisObject, id));
499 DeviceAPI::Common::IListenerItemPtr listenerItem = DPL::StaticPointerCast<DeviceAPI::Common::IListenerItem>(canceller);
500 CallHistoryListenerManagerSingleton::Instance().registerListener(listenerItem, gContext);
502 return JSUtil::toJSValueRef(context, id);
504 } catch(const BasePlatformException& err){
505 return JSWebAPIError::throwException(context, exception, err);
506 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
507 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
508 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
509 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage());
510 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
511 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
512 } catch(const WrtDeviceApis::Commons::Exception& ex) {
513 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
517 JSValueRef JSCallHistory::removeChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
518 const JSValueRef arguments[], JSValueRef* exception) {
520 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
521 CALL_HISTORY_FUNCTION_API_REMOVELISTENER);
523 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
527 ArgumentValidator validator(context, argumentCount, arguments);
529 handle = validator.toLong(0);
531 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
534 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
537 JSContextRef gContext = priv->getContext();
540 ICallHistoryPtr callHistory(priv->getObject());
541 callHistory->removeListener(handle);
543 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error : handle");
546 CallHistoryListenerCancellerPtr canceller = CallHistoryListenerCancellerPtr(new CallHistoryListenerCanceller(gContext, thisObject, handle));
547 DeviceAPI::Common::IListenerItemPtr listenerItem = DPL::StaticPointerCast<DeviceAPI::Common::IListenerItem>(canceller);
548 CallHistoryListenerManagerSingleton::Instance().unregisterListener(listenerItem);
549 } catch(const BasePlatformException& err){
550 return JSWebAPIError::throwException(context, exception, err);
551 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
552 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
553 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
554 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage());
555 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
556 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
557 } catch(const WrtDeviceApis::Commons::Exception& ex) {
558 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
561 return JSValueMakeUndefined(context);