Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[WEEX-570][Android] add ut details (#1442)
Browse files Browse the repository at this point in the history
Add ut to track component and module register status
  • Loading branch information
Darin726 authored and YorkShen committed Aug 16, 2018
1 parent f7ee337 commit d8dfd54
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1920,8 +1920,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()) {
Expand All @@ -1935,13 +1938,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 );
}
}

Expand All @@ -1962,17 +1968,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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public enum WXErrorCode {
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
*/
Expand Down

0 comments on commit d8dfd54

Please sign in to comment.