From: Tomasz Marciniak Date: Mon, 18 May 2015 13:51:42 +0000 (+0200) Subject: [Sound] Throw exception if listener does not exists. X-Git-Tag: submit/tizen_tv/20150603.064601~1^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab0a89adfa91e90a49c0fe81f7e5b44d77f84cb0;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Sound] Throw exception if listener does not exists. [Verification] Code compiles without errors. Manual test SoundManager_removeDeviceStateChangeListener passes. Change-Id: I81cd390cbed3eff74f97211c34de464c198fa5d8 Signed-off-by: Tomasz Marciniak --- diff --git a/src/sound/sound_api.js b/src/sound/sound_api.js index 24606573..e4a7a98f 100644 --- a/src/sound/sound_api.js +++ b/src/sound/sound_api.js @@ -71,6 +71,9 @@ ListenerManager.prototype.addListener = function(callback) { ListenerManager.prototype.removeListener = function(watchId) { if (this.listeners.hasOwnProperty(watchId)) { delete this.listeners[watchId]; + } else { + throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR, + 'Listener with id: ' + watchId + ' does not exist.'); } if (this.nativeSet && type_.isEmptyObject(this.listeners)) {