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>
35 #include "JSCallHistoryEntry.h"
36 #include "JSCallHistory.h"
37 #include "CallHistoryStaticController.h"
38 #include "CallHistoryMultiCallback.h"
39 #include "ResponseDispatcher.h"
40 #include "Converter.h"
41 #include "plugin_config.h"
42 #include "CallHistoryAsyncCallbackManager.h"
43 #include "CallHistoryListenerManager.h"
49 using namespace WrtDeviceApis::Commons;
50 using namespace WrtDeviceApis::CommonsJavaScript;
51 using namespace DeviceAPI::Tizen;
52 using namespace DeviceAPI::Common;
55 namespace CallHistory {
58 JSClassRef JSCallHistory::m_jsClassRef = NULL;
60 JSClassDefinition JSCallHistory::m_classInfo =
63 kJSClassAttributeNone,
81 JSStaticValue JSCallHistory::m_property[] = {
85 JSStaticFunction JSCallHistory::m_function[] =
87 { "find", JSCallHistory::find, kJSPropertyAttributeNone },
88 { "remove", JSCallHistory::remove, kJSPropertyAttributeNone },
89 { "removeBatch", JSCallHistory::removeBatch, kJSPropertyAttributeNone },
90 { "removeAll", JSCallHistory::removeAll, kJSPropertyAttributeNone },
91 { "addChangeListener", JSCallHistory::addChangeListener, kJSPropertyAttributeNone },
92 { "removeChangeListener", JSCallHistory::removeChangeListener, kJSPropertyAttributeNone },
96 const JSClassRef JSCallHistory::getClassRef() {
98 m_jsClassRef = JSClassCreate(&m_classInfo);
103 const JSClassDefinition* JSCallHistory::getClassInfo(){
107 void JSCallHistory::initialize(JSContextRef context, JSObjectRef object) {
108 JSCallHistoryPriv* priv = static_cast<JSCallHistoryPriv*>(JSObjectGetPrivate(object));
111 ICallHistoryPtr CallHistory(CallHistoryFactory::getInstance().getCallHistoryObject());
112 priv = new JSCallHistoryPriv(context, CallHistory);
113 if(!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
119 void JSCallHistory::finalize(JSObjectRef object) {
120 JSCallHistoryPriv* priv = static_cast<JSCallHistoryPriv*>(JSObjectGetPrivate(object));
122 JSObjectSetPrivate(object, NULL);
127 JSObjectRef JSCallHistory::createJSObject(JSContextRef context, JSObjectRef object)
129 ICallHistoryPtr CallHistory(CallHistoryFactory::getInstance().getCallHistoryObject());
130 JSCallHistoryPriv* priv = new JSCallHistoryPriv(context, CallHistory);
132 return JSObjectMake(context, getClassRef(), priv);
135 bool JSCallHistory::hasInstance(JSContextRef context, JSObjectRef constructor,
136 JSValueRef possibleInstance, JSValueRef* exception) {
137 return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
140 JSValueRef JSCallHistory::find(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
141 const JSValueRef arguments[], JSValueRef* exception) {
143 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
144 CALL_HISTORY_FUNCTION_API_FIND);
146 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
148 if (argumentCount < 1) {
149 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
152 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
155 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
158 JSContextRef gContext = priv->getContext();
159 WrtDeviceApis::CommonsJavaScript::Converter converter(context);
160 Validator check(context, exception);
162 JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
165 if (argumentCount >= 1) {
166 if (JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0])) {
167 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : success callback ");
168 } else if (!JSObjectIsFunction(context, converter.toJSObjectRef(arguments[0]))) {
169 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : success callback ");
171 cbm->setOnSuccess(arguments[0]);
174 if (argumentCount >= 2) {
175 if (!JSValueIsNull(context, arguments[1]) && !JSValueIsUndefined(context, arguments[1])) {
176 if (!JSObjectIsFunction(context, converter.toJSObjectRef(arguments[1]))) {
177 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : error callback ");
179 cbm->setOnError(arguments[1]);
183 if (argumentCount >= 3) {
184 if (!JSValueIsNull(context, arguments[2]) && !JSValueIsUndefined(context, arguments[2])) {
185 if (!JSValueIsObject(context, arguments[2])) {
186 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : filter");
191 cbm->setObject(thisObject);
193 FilterConverterFactory::ConverterType filterConverter = FilterConverterFactory::getConverter(context);
195 EventFindCallHistoryPtr event(new EventFindCallHistory());
196 ICallHistoryPtr callHistory(priv->getObject());
198 event->setPrivateData(StaticPointerCast<IEventPrivateData> (cbm));
199 event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
201 if (argumentCount >= 3) {
202 if (!check.isNullOrUndefined(arguments[2])) {
203 FilterPtr filter = filterConverter->toFilter(arguments[2]);
204 event ->setFilter(filter);
208 if (argumentCount >= 4) {
209 if (!check.isNullOrUndefined(arguments[3])) {
210 event->setSortMode(filterConverter->toSortMode(arguments[3]));
214 if (argumentCount >= 5) {
215 if (!check.isNullOrUndefined(arguments[4])) {
216 event->setLimit(converter.toULong(arguments[4]));
220 if (argumentCount >= 6) {
221 if (!check.isNullOrUndefined(arguments[5])) {
222 event->setOffset(converter.toULong(arguments[5]));
225 callHistory->find(event);
226 CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
227 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
228 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
229 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
230 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage()));
231 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
232 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
233 } catch(const WrtDeviceApis::Commons::Exception& ex) {
234 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
237 return JSValueMakeUndefined(context);
240 JSValueRef JSCallHistory::remove(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
241 const JSValueRef arguments[], JSValueRef* exception) {
243 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
244 CALL_HISTORY_FUNCTION_API_REMOVE);
246 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
248 if (argumentCount < 1) {
249 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
252 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
255 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
258 Converter converter(context);
261 if (!JSValueIsObjectOfClass(context, arguments[0], JSCallHistoryEntry::getClassRef())) {
262 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : CallHistoryEntry");
265 ICallHistoryPtr callHistory(priv->getObject());
266 CallHistoryEntryPropertiesPtr entry = converter.toCallHistoryEntryProperties(arguments[0]);
267 callHistory->remove(entry->getEntryId());
268 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
269 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
270 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
271 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage());
272 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
273 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
274 } catch(const WrtDeviceApis::Commons::Exception& ex) {
275 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
278 return JSValueMakeUndefined(context);
281 JSValueRef JSCallHistory::removeBatch(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
282 const JSValueRef arguments[], JSValueRef* exception) {
284 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
285 CALL_HISTORY_FUNCTION_API_REMOVE_BATCH);
287 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
289 if (argumentCount < 1) {
290 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
293 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
296 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
299 JSContextRef gContext = priv->getContext();
300 Converter converter(context);
302 JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
304 if (JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0])) {
305 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Invalid values error : CallHistoryEntry array");
306 } else if (!JSIsArrayValue(context, arguments[0])) {
307 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : CallHistoryEntry array");
310 if (argumentCount >= 2) {
311 if (!JSValueIsNull(context, arguments[1]) && !JSValueIsUndefined(context, arguments[1])) {
312 if (!JSObjectIsFunction(context, converter.toJSObjectRef(arguments[1]))) {
313 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : success callback");
315 cbm->setOnSuccess(arguments[1]);
319 if (argumentCount >= 3) {
320 if (!JSValueIsNull(context, arguments[2]) && !JSValueIsUndefined(context, arguments[2])) {
321 if (!JSObjectIsFunction(context, converter.toJSObjectRef(arguments[2]))) {
322 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : error callback");
324 cbm->setOnError(arguments[2]);
328 cbm->setObject(thisObject);
330 EventRemoveBatchPtr event(new EventRemoveBatch());
331 ICallHistoryPtr callHistory(priv->getObject());
333 event->setPrivateData(StaticPointerCast<IEventPrivateData> (cbm));
334 event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
336 CallHistoryEntryList entryList = converter.toVectorOfCallHistoryEntryProperties(arguments[0]);
338 std::vector<unsigned long> entryIds;
340 if (entryList.size() > 0) {
341 for (unsigned int i = 0; i < entryList.size(); i++) {
342 entryIds.push_back(entryList[i]->getEntryId());
344 event->setEntryIds(entryIds);
345 callHistory->removeBatch(event);
346 CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
348 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error : Entry array is empty"));
350 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
351 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
352 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
353 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage()));
354 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
355 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
356 } catch(const WrtDeviceApis::Commons::Exception& ex) {
357 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
360 return JSValueMakeUndefined(context);
363 JSValueRef JSCallHistory::removeAll(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
364 const JSValueRef arguments[], JSValueRef* exception) {
366 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
367 CALL_HISTORY_FUNCTION_API_REMOVE_ALL);
369 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
371 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
374 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
377 JSContextRef gContext = priv->getContext();
378 Converter converter(context);
380 JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
383 if (argumentCount >= 1) {
384 if (!JSValueIsNull(context, arguments[0]) && !JSValueIsUndefined(context, arguments[0])) {
385 if (!JSObjectIsFunction(context, converter.toJSObjectRef(arguments[0]))) {
386 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : success callback");
388 cbm->setOnSuccess(arguments[0]);
392 if (argumentCount >= 2) {
393 if (!JSValueIsNull(context, arguments[1]) && !JSValueIsUndefined(context, arguments[1])) {
394 if (!JSObjectIsFunction(context, converter.toJSObjectRef(arguments[1]))) {
395 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : error callback");
397 cbm->setOnError(arguments[1]);
401 cbm->setObject(thisObject);
402 EventRemoveAllPtr event(new EventRemoveAll());
403 ICallHistoryPtr callHistory(priv->getObject());
405 event->setPrivateData(StaticPointerCast<IEventPrivateData> (cbm));
406 event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
407 callHistory->removeAll(event);
408 CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
409 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
410 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
411 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
412 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage()));
413 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
414 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
415 } catch(const WrtDeviceApis::Commons::Exception& ex) {
416 cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
419 return JSValueMakeUndefined(context);
422 JSValueRef JSCallHistory::deleteRecording(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
423 const JSValueRef arguments[], JSValueRef* exception) {
425 return JSValueMakeUndefined(context);
428 JSValueRef JSCallHistory::addChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
429 const JSValueRef arguments[], JSValueRef* exception) {
431 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
432 CALL_HISTORY_FUNCTION_API_ADDLISTENER);
434 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
436 if (argumentCount < 1) {
437 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
440 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
443 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
446 JSContextRef gContext = priv->getContext();
447 Converter converter(context);
451 if (argumentCount >= 1) {
452 EventCallHistoryListenerPrivateDataPtr privData(converter.toEventCallHistoryListenerPrivateData(arguments[0], gContext));
454 EventCallHistoryListenerEmitterPtr emitter(new EventCallHistoryListenerEmitter);
455 emitter->setListener(&CallHistoryStaticController::getInstance());
456 emitter->setEventPrivateData(DPL::StaticPointerCast<EventCallHistoryListener::PrivateDataType>(privData));
458 ICallHistoryPtr callHistory(priv->getObject());
459 id = callHistory->addListener(emitter);
461 LogDebug("addChangeListener : id [" <<id<<"]");
463 CallHistoryListenerCancellerPtr canceller = CallHistoryListenerCancellerPtr(new CallHistoryListenerCanceller(gContext, thisObject, id));
464 DeviceAPI::Common::IListenerItemPtr listenerItem = DPL::StaticPointerCast<DeviceAPI::Common::IListenerItem>(canceller);
465 CallHistoryListenerManagerSingleton::Instance().registerListener(listenerItem, gContext);
467 return JSUtil::toJSValueRef(context, id);
469 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
470 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
471 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
472 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage());
473 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
474 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
475 } catch(const WrtDeviceApis::Commons::Exception& ex) {
476 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
480 JSValueRef JSCallHistory::removeChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
481 const JSValueRef arguments[], JSValueRef* exception) {
483 AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
484 CALL_HISTORY_FUNCTION_API_REMOVELISTENER);
486 TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
488 if (argumentCount < 1) {
489 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
492 JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
495 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
498 JSContextRef gContext = priv->getContext();
499 Converter converter(context);
500 Validator check(context, exception);
505 if (argumentCount >= 1) {
506 if (check.isNullOrUndefined(arguments[0])) {
507 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error : handle");
510 id=JSUtil::JSValueToLong(context, arguments[0]);
511 LogDebug("removeChangeListener : id [" <<id<<"]");
515 ICallHistoryPtr callHistory(priv->getObject());
516 callHistory->removeListener(id);
518 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error : handle");
521 CallHistoryListenerCancellerPtr canceller = CallHistoryListenerCancellerPtr(new CallHistoryListenerCanceller(gContext, thisObject, id));
522 DeviceAPI::Common::IListenerItemPtr listenerItem = DPL::StaticPointerCast<DeviceAPI::Common::IListenerItem>(canceller);
523 CallHistoryListenerManagerSingleton::Instance().unregisterListener(listenerItem);
524 } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
525 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
526 } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
527 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage());
528 } catch(const WrtDeviceApis::Commons::PlatformException& ex) {
529 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
530 } catch(const WrtDeviceApis::Commons::Exception& ex) {
531 return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
534 return JSValueMakeUndefined(context);