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

[data-render] reportJSException compare funtion name using CreatePageWithContent #2384

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ public class WXBridgeManager implements Callback, BactchExecutor {

private static Class clazz_debugProxy = null;
public static final String METHOD_CREATE_INSTANCE = "createInstance";
public static final String METHOD_CREATE_PAGE_WITH_CONTENT = "CreatePageWithContent";
public static final String METHOD_UPDATE_COMPONENT_WITH_DATA = "UpdateComponentData";
public static final String METHOD_DESTROY_INSTANCE = "destroyInstance";
public static final String METHOD_CALL_JS = "callJS";
public static final String METHOD_SET_TIMEOUT = "setTimeoutCallback";
Expand Down Expand Up @@ -2366,27 +2368,39 @@ public void reportJSException(String instanceId, String function,
if (instanceId != null && (instance = WXSDKManager.getInstance().getSDKInstance(instanceId)) != null) {
instance.setHasException(true);
exception += "\n getTemplateInfo==" +instance.getTemplateInfo();//add network header info
if (METHOD_CREATE_INSTANCE.equals(function) || !instance.isContentMd5Match()) {
if ((METHOD_CREATE_INSTANCE.equals(function) || METHOD_UPDATE_COMPONENT_WITH_DATA.equals(function) || METHOD_CREATE_PAGE_WITH_CONTENT.equals(function)) || !instance.isContentMd5Match()) {
try {
if (isJSFrameworkInit() && (reInitCount > 1 && reInitCount < 10) && !instance.isNeedReLoad()) {
new ActionReloadPage(instanceId, true).executeAction();
instance.setNeedLoad(true);
return;
} else {
WXErrorCode degreeErrorCode;
if(TextUtils.equals(function, METHOD_CREATE_PAGE_WITH_CONTENT) || TextUtils.equals(function, METHOD_UPDATE_COMPONENT_WITH_DATA)){
degreeErrorCode = WXErrorCode.WX_DEGRAD_EAGLE_RENDER_ERROR;
} else {
degreeErrorCode = WXErrorCode.WX_DEGRAD_ERR_INSTANCE_CREATE_FAILED;
}
String errorMsg = new StringBuilder()
.append(WXErrorCode.WX_DEGRAD_ERR_INSTANCE_CREATE_FAILED.getErrorMsg())
.append(degreeErrorCode.getErrorMsg())
.append(", reportJSException >>>> instanceId:").append(instanceId)
.append(", exception function:").append(function)
.append(", exception:").append(exception)
.append(", extInitTime:").append(System.currentTimeMillis()-WXBridgeManager.sInitFrameWorkTimeOrigin).append("ms")
.append(", extInitErrorMsg:").append(WXBridgeManager.sInitFrameWorkMsg.toString())
.toString();
instance.onRenderError(//DegradPassivity to H5
WXErrorCode.WX_DEGRAD_ERR_INSTANCE_CREATE_FAILED.getErrorCode(),
degreeErrorCode.getErrorCode(),
errorMsg
);
if (!WXEnvironment.sInAliWeex){
WXExceptionUtils.commitCriticalExceptionRT(instanceId,WXErrorCode.WX_RENDER_ERR_JS_CREATE_INSTANCE,function,exception,null);
WXErrorCode errCode;
if (METHOD_CREATE_INSTANCE.equals(function)){
errCode = WXErrorCode.WX_RENDER_ERR_JS_CREATE_INSTANCE;
} else {
errCode = WXErrorCode.WX_DEGRAD_EAGLE_RENDER_ERROR;
}
WXExceptionUtils.commitCriticalExceptionRT(instanceId,errCode,function,exception,null);
}
return;
}
Expand All @@ -2396,8 +2410,10 @@ public void reportJSException(String instanceId, String function,
}
if (METHOD_CREATE_INSTANCE.equals(function) && !instance.getApmForInstance().hasAddView){
reportErrorCode = WXErrorCode.WX_RENDER_ERR_JS_CREATE_INSTANCE;
}else if ( METHOD_CREATE_INSTANCE_CONTEXT.equals(function) && !instance.getApmForInstance().hasAddView){
} else if ( METHOD_CREATE_INSTANCE_CONTEXT.equals(function) && !instance.getApmForInstance().hasAddView){
reportErrorCode = WXErrorCode.WX_RENDER_ERR_JS_CREATE_INSTANCE_CONTEXT;
} else if ((METHOD_UPDATE_COMPONENT_WITH_DATA.equals(function) || METHOD_CREATE_PAGE_WITH_CONTENT.equals(function)) && !instance.getApmForInstance().hasAddView){
reportErrorCode = WXErrorCode.WX_DEGRAD_EAGLE_RENDER_ERROR;
}
instance.onJSException(reportErrorCode.getErrorCode(), function, exception);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ public enum WXErrorCode {

WX_DEGRAD_ERR_INSTANCE_CREATE_FAILED_JS("-1006", "degradeToH5|createInstance fail|wx_create_instance_error",ErrorType.DEGRAD_ERROR,ErrorGroup.JS),

WX_DEGRAD_EAGLE_RENDER_ERROR ("-1007", "degradeToH5|eagleRenderErr", ErrorType.DEGRAD_ERROR, ErrorGroup.JS),

WX_ERR_HASH_MAP_TMP("-10010", "WX_ERR_HASH_MAP_TMP",ErrorType.NATIVE_ERROR,ErrorGroup.NATIVE),

/**
Expand Down