[Application] Throw an exception if requested listener is not found.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 27 Jul 2015 11:41:51 +0000 (13:41 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 27 Jul 2015 11:41:51 +0000 (13:41 +0200)
[Verification] UTC_application_removeAppInfoEventListener_N_001 passes.
               TCT pass rate: 100%

Change-Id: Ia394cabe0f98f79fd787c22abcc4612d627f8e11
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/application/application_api.js

index ad176bd..4a5d757 100755 (executable)
@@ -529,6 +529,8 @@ ListenerManager.prototype.addListener = function(callback) {
 ListenerManager.prototype.removeListener = function(watchId) {
   if (this.listeners.hasOwnProperty(watchId)) {
     delete this.listeners[watchId];
+  } else {
+    throw new WebAPIException(WebAPIException.NOT_FOUND_ERR, 'Specified listener does not exist');
   }
 
   if (this.nativeSet && T.isEmptyObject(this.listeners)) {