class WXExceptionUtils {

  public static void commitCriticalExceptionRT(@Nullable final String instanceId,
											   @Nullable final String errCode,
											   @Nullable final String function,
											   @Nullable final String exception,
											   @Nullable final Map<String,String> extParams ) {
	IWXJSExceptionAdapter adapter = WXSDKManager.getInstance().getIWXJSExceptionAdapter();
	WXSDKInstance instance;
	WXJSExceptionInfo exceptionCommit;
	String bundleUrlCommit = "BundleUrlDefault";
	String instanceIdCommit = "InstanceIdDefalut";
	String exceptionMsgCommit = exception;
	Map<String, String> commitMap = extParams;

	if (!TextUtils.isEmpty(instanceId)) {
	  instanceIdCommit = instanceId;
	  instance = WXSDKManager.getInstance().getSDKInstance(instanceId);

	  if (null != instance && instance.getContext() != null && instance.getBundleUrl() != null) {
		bundleUrlCommit = instance.getBundleUrl();
		exceptionMsgCommit += "\n instance.getTemplateInfo()==" + instance.getTemplateInfo();
		if (TextUtils.isEmpty(bundleUrlCommit) || bundleUrlCommit.equals(WXPerformance.DEFAULT)) {
		  if (!TextUtils.equals(degradeUrl, "BundleUrlDefaultDegradeUrl")) {
			bundleUrlCommit = degradeUrl;
		  } else
			bundleUrlCommit = WXSDKInstance.requestUrl;
		}
	  }
	} else {//instance is null for instance id is null
	  if (!TextUtils.isEmpty(WXSDKInstance.requestUrl)) {
		bundleUrlCommit = WXSDKInstance.requestUrl;
	  }
	  if (commitMap != null && commitMap.size() > 0) {
		bundleUrlCommit = TextUtils.isEmpty(commitMap.get("weexUrl")) ? commitMap.get("weexUrl")
				: commitMap.get("bundleUrl");
	  }
	}

	if (adapter != null) {
	  exceptionCommit = new WXJSExceptionInfo(instanceIdCommit, bundleUrlCommit, errCode, function, exceptionMsgCommit, commitMap);
	  adapter.onJSException(exceptionCommit);
	  WXLogUtils.e(exceptionCommit.toString());
	}
  }

}