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

Commit

Permalink
[data-render] reportJSException compare funtion name using CreatePage…
Browse files Browse the repository at this point in the history
…WithContent (#2384)

* [data-render] reportJSException compare funtion name using CreatePageWithContent or UpdateComponentData
  • Loading branch information
hpop1994 authored and YorkShen committed May 8, 2019
1 parent bbad3f7 commit 9eb13af
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
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 @@ -2380,7 +2382,7 @@ 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 {
//data render mode should report exception instead of reload page,
// so we use !isSkipFrameworkInit(instanceId) to skip the positive branch of if clause.
Expand All @@ -2389,20 +2391,32 @@ public void reportJSException(String instanceId, String function,
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 @@ -2412,8 +2426,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

0 comments on commit 9eb13af

Please sign in to comment.