[Tool][Generator] ExceptionMap removed from JS template
authorRafal Galka <r.galka@samsung.com>
Thu, 8 Jan 2015 13:11:27 +0000 (14:11 +0100)
committerRafal Galka <r.galka@samsung.com>
Wed, 14 Jan 2015 08:27:56 +0000 (17:27 +0900)
[Message] Exception 'name' to 'code' mapping is implemented
in tizen.WebAPIException (tizen_api.js lines 138-141)

Change-Id: I48a3f5dc5bd44d2bde4165de90c91bad31291f51

tools/skeleton_generator/tpl/tpl_api.js

index 3791c8fddac44df294ba8437fd572d1e8f598520..607af1bea0aa82fab2ff476d0f5902d0cc2f94b4 100644 (file)
@@ -25,21 +25,6 @@ function nextCallbackId() {
     return callbackId++;
 }
 
-var ExceptionMap = {
-    'UnknownError' : tizen.WebAPIException.UNKNOWN_ERR ,
-    'TypeMismatchError' : tizen.WebAPIException.TYPE_MISMATCH_ERR ,
-    'InvalidValuesError' : tizen.WebAPIException.INVALID_VALUES_ERR ,
-    'IOError' : tizen.WebAPIException.IO_ERR ,
-    'ServiceNotAvailableError' : tizen.WebAPIException.SERVICE_NOT_AVAILABLE_ERR ,
-    'SecurityError' : tizen.WebAPIException.SECURITY_ERR ,
-    'NetworkError' : tizen.WebAPIException.NETWORK_ERR ,
-    'NotSupportedError' : tizen.WebAPIException.NOT_SUPPORTED_ERR ,
-    'NotFoundError' : tizen.WebAPIException.NOT_FOUND_ERR ,
-    'InvalidAccessError' : tizen.WebAPIException.INVALID_ACCESS_ERR ,
-    'AbortError' : tizen.WebAPIException.ABORT_ERR ,
-    'QuotaExceededError' : tizen.WebAPIException.QUOTA_EXCEEDED_ERR ,
-}
-
 function callNative(cmd, args) {
     var json = {'cmd':cmd, 'args':args};
     var argjson = JSON.stringify(json);
@@ -58,11 +43,7 @@ function callNative(cmd, args) {
     } else if (result['status'] == 'error') {
         var err = result['error'];
         if(err) {
-            if(ExceptionMap[err.name]) {
-                throw new tizen.WebAPIException(ExceptionMap[err.name], err.message);
-            } else {
-                throw new tizen.WebAPIException(tizen.WebAPIException.UNKNOWN_ERR, err.message);
-            }
+            throw new tizen.WebAPIException(err.name, err.message);
         }
         return false;
     }