YorkShen closed pull request #1442: [WEEX-570][Android] add ut details
URL: https://github.com/apache/incubator-weex/pull/1442
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
index f034be3f3f..36cc30a4a1 100644
--- a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
+++ b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
@@ -1923,8 +1923,11 @@ private void invokeRegisterModules(Map<String, Object>
modules, List<Map<String,
}
WXJSObject[] args = {WXWsonJSONSwitch.toWsonOrJsonWXJSObject(modules)};
+ String errorMsg = null;
try {
- mWXBridge.execJS("", null, METHOD_REGISTER_MODULES, args);
+ if(0 == mWXBridge.execJS("", null, METHOD_REGISTER_MODULES, args)) {
+ errorMsg = "execJS error";
+ }
try {
Iterator<String> iter = modules.keySet().iterator();
while (iter.hasNext()) {
@@ -1938,13 +1941,16 @@ private void invokeRegisterModules(Map<String, Object>
modules, List<Map<String,
WXLogUtils.e("Weex [invokeRegisterModules]", e);
}
} catch (Throwable e) {
- WXExceptionUtils.commitCriticalExceptionRT(null,
- WXErrorCode.WX_KEY_EXCEPTION_INVOKE_REGISTER_MODULES,
- "invokeRegisterModules",
WXErrorCode.WX_KEY_EXCEPTION_INVOKE_REGISTER_MODULES.getErrorMsg() +
- " \n " + e.getMessage() + modules.entrySet().toString(),
- null );
+ errorMsg =
WXErrorCode.WX_KEY_EXCEPTION_INVOKE_REGISTER_MODULES.getErrorMsg() +
+ " \n " + e.getMessage() + modules.entrySet().toString();
+ }
- WXLogUtils.e("[WXBridgeManager] invokeRegisterModules:", e);
+ if(!TextUtils.isEmpty(errorMsg)) {
+ WXLogUtils.e("[WXBridgeManager] invokeRegisterModules:", errorMsg);
+ WXExceptionUtils.commitCriticalExceptionRT(null,
+ WXErrorCode.WX_KEY_EXCEPTION_INVOKE_REGISTER_MODULES,
+ "invokeRegisterModules", errorMsg,
+ null );
}
}
@@ -1965,17 +1971,23 @@ private void invokeRegisterComponents(List<Map<String,
Object>> components, List
}
WXJSObject[] args = {WXWsonJSONSwitch.toWsonOrJsonWXJSObject(components)};
+ String errorMsg = null;
try {
- mWXBridge.execJS("", null, METHOD_REGISTER_COMPONENTS, args);
+ if(0 == mWXBridge.execJS("", null, METHOD_REGISTER_COMPONENTS, args)) {
+ errorMsg = "execJS error";
+ }
} catch (Throwable e) {
- WXLogUtils.e("[WXBridgeManager] invokeRegisterComponents ", e);
- WXExceptionUtils.commitCriticalExceptionRT(null,
- WXErrorCode.WX_KEY_EXCEPTION_INVOKE_REGISTER_CONTENT_FAILED,
- METHOD_REGISTER_COMPONENTS,
- WXErrorCode.WX_KEY_EXCEPTION_INVOKE_REGISTER_CONTENT_FAILED
- + args.toString()
- + WXLogUtils.getStackTrace(e),
- null);
+ errorMsg = WXErrorCode.WX_KEY_EXCEPTION_INVOKE_REGISTER_COMPONENT
+ + args.toString()
+ + WXLogUtils.getStackTrace(e);
+ }
+
+ if(!TextUtils.isEmpty(errorMsg)) {
+ WXLogUtils.e("[WXBridgeManager] invokeRegisterComponents ", errorMsg);
+ WXExceptionUtils.commitCriticalExceptionRT(null,
+ WXErrorCode.WX_KEY_EXCEPTION_INVOKE_REGISTER_COMPONENT,
+ METHOD_REGISTER_COMPONENTS, errorMsg,
+ null);
}
}
diff --git a/android/sdk/src/main/java/com/taobao/weex/common/WXErrorCode.java
b/android/sdk/src/main/java/com/taobao/weex/common/WXErrorCode.java
index 9415ca07bf..cf2d49ac26 100644
--- a/android/sdk/src/main/java/com/taobao/weex/common/WXErrorCode.java
+++ b/android/sdk/src/main/java/com/taobao/weex/common/WXErrorCode.java
@@ -192,7 +192,7 @@
WX_KEY_EXCEPTION_INVOKE_REGISTER_CONTENT_FAILED("-9101",
"[WX_KEY_EXCEPTION_INVOKE_REGISTER_CONTENT_FAILED]
details",ErrorType.NATIVE_ERROR,ErrorGroup.NATIVE),
WX_KEY_EXCEPTION_INVOKE_JSSERVICE_EXECUTE("-9102",
"[WX_KEY_EXCEPTION_INVOKE_JSSERVICE_EXECUTE]
details",ErrorType.NATIVE_ERROR,ErrorGroup.NATIVE),
WX_KEY_EXCEPTION_INVOKE_REGISTER_MODULES("-9103",
"[WX_KEY_EXCEPTION_INVOKE_REGISTER_MODULES]
details",ErrorType.NATIVE_ERROR,ErrorGroup.NATIVE),
-
+ WX_KEY_EXCEPTION_INVOKE_REGISTER_COMPONENT("-9104",
"[WX_KEY_EXCEPTION_INVOKE_REGISTER_COMPONENT]
details",ErrorType.NATIVE_ERROR,ErrorGroup.NATIVE),
/**
* WX Key Exception Commit Bundle Js Download
*/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services