Add a function to convert aul error 99/140199/2 accepted/tizen/3.0/common/20170728.153310 accepted/tizen/3.0/ivi/20170728.004835 accepted/tizen/3.0/mobile/20170728.004750 accepted/tizen/3.0/tv/20170728.004805 accepted/tizen/3.0/wearable/20170728.004822 submit/tizen_3.0/20170725.224529 submit/tizen_3.0/20170726.030918
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 24 Jul 2017 06:55:10 +0000 (15:55 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 25 Jul 2017 00:22:18 +0000 (09:22 +0900)
Change-Id: Id6a1ef0fa86525113e1cf24c4d689196f6d38357
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/widget_instance.c

index 4b321ef..e6a2c4f 100644 (file)
@@ -309,6 +309,35 @@ EAPI int widget_instance_create(const char *widget_id, char **instance_id)
        return -1;
 }
 
+static int __convert_aul_error(int res)
+{
+       int ret;
+
+       switch (res) {
+       case AUL_R_EREJECTED:
+       case AUL_R_ENOAPP:
+               ret = WIDGET_ERROR_NOT_EXIST;
+               break;
+       case AUL_R_EILLACC:
+               ret = WIDGET_ERROR_PERMISSION_DENIED;
+               break;
+       case AUL_R_ETIMEOUT:
+               ret = WIDGET_ERROR_TIMED_OUT;
+               break;
+       case AUL_R_ECANCELED:
+               ret = WIDGET_ERROR_CANCELED;
+               break;
+       case AUL_R_EINVAL:
+               ret = WIDGET_ERROR_INVALID_PARAMETER;
+               break;
+       default:
+               ret = WIDGET_ERROR_FAULT;
+               break;
+       }
+
+       return ret;
+}
+
 static int __launch(const char *widget_id, const char *instance_id, bundle *extra)
 {
        int ret = 0;
@@ -336,6 +365,8 @@ static int __launch(const char *widget_id, const char *instance_id, bundle *extr
        aul_svc_set_operation(b, AUL_SVC_OPERATION_LAUNCH_WIDGET);
 
        ret = aul_launch_app_async(appid, b);
+       if (ret < 0)
+               ret = __convert_aul_error(ret);
 
        if (!extra) {
                bundle_free(b);