[Account] Throw NotFoundException when accountId was not initialized 60/72960/2
authorJakub Skowron <j.skowron@samsung.com>
Fri, 3 Jun 2016 08:34:07 +0000 (10:34 +0200)
committerJakub Skowron <j.skowron@samsung.com>
Fri, 3 Jun 2016 09:46:43 +0000 (11:46 +0200)
Change-Id: Iffbb30f62d2f52b3f01e43e150514b8fb953ea01
Signed-off-by: Jakub Skowron <j.skowron@samsung.com>
src/account/account_api.js

index 31c0b08324c7da25f66d77db4dace5ad8d76ada6..8ea2311fe97dc6c09e9eee21fe3fac11b1185e6b 100755 (executable)
@@ -82,6 +82,10 @@ Account.prototype.setExtendedData = function() {
         { name: 'value', type: types_.STRING }
     ]);
 
+    if( this.id === null ) {
+        throw new WebAPIException( WebAPIException.NOT_FOUND_ERR, "Account ID was not initialized." );
+    }
+
     var result = native_.callSync('Account_setExtendedData',
                                   {
                                       accountId: this.id,
@@ -111,6 +115,10 @@ Account.prototype.getExtendedData = function() {
             }
         ]);
 
+        if( this.id === null ) {
+            throw new WebAPIException( WebAPIException.NOT_FOUND_ERR, "Account ID was not initialized." );
+        }
+
         var result = native_.call('Account_getExtendedData', { accountId: this.id },
             function(result) {
               if (native_.isFailure(result)) {
@@ -135,6 +143,10 @@ Account.prototype.getExtendedData = function() {
             { name: 'key', type: types_.STRING }
         ]);
 
+        if( this.id === null ) {
+            throw new WebAPIException( WebAPIException.NOT_FOUND_ERR, "Account ID was not initialized." );
+        }
+
         var result = native_.callSync('Account_getExtendedDataSync',
                                       {
                                            accountId: this.id,