Java Code Examples for com.taobao.weex.WXSDKInstance#onJSException()

The following examples show how to use com.taobao.weex.WXSDKInstance#onJSException() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WXBridgeManager.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
/**
 * Report JavaScript Exception
 */
public void reportJSException(String instanceId, String function,
                              String exception) {
  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.e("reportJSException >>>> instanceId:" + instanceId
                 + ", exception function:" + function + ", exception:"
                 + exception);
  }
  WXSDKInstance instance;
  if (instanceId != null && (instance = WXSDKManager.getInstance().getSDKInstance(instanceId)) != null) {
    instance.onJSException(WXErrorCode.WX_ERR_JS_EXECUTE.getErrorCode(), function, exception);

    String err = "function:" + function + "#exception:" + exception;
    commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_ERR_JS_EXECUTE, err);

    IWXJSExceptionAdapter adapter = WXSDKManager.getInstance().getIWXJSExceptionAdapter();
    if (adapter != null) {
      WXJSExceptionInfo jsException = new WXJSExceptionInfo(instanceId, instance.getBundleUrl(), WXErrorCode.WX_ERR_JS_EXECUTE.getErrorCode(), function, exception, null);
      adapter.onJSException(jsException);
      if (WXEnvironment.isApkDebugable()) {
        WXLogUtils.d(jsException.toString());
      }
    }
  }
}
 
Example 2
Source File: WXBridgeManager.java    From weex-uikit with MIT License 6 votes vote down vote up
/**
 * Report JavaScript Exception
 */
public void reportJSException(String instanceId, String function,
                              String exception) {
  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.e("reportJSException >>>> instanceId:" + instanceId
                 + ", exception function:" + function + ", exception:"
                 + exception);
  }
  WXSDKInstance instance;
  if (instanceId != null && (instance = WXSDKManager.getInstance().getSDKInstance(instanceId)) != null) {
    // TODO add errCode
    instance.onJSException(null, function, exception);

    String err="function:"+function+"#exception:"+exception;
    commitJSBridgeAlarmMonitor(instanceId,WXErrorCode.WX_ERR_JS_EXECUTE,err);
  }
}
 
Example 3
Source File: WXBridgeManager.java    From weex with Apache License 2.0 6 votes vote down vote up
/**
 * Report JavaScript Exception
 */
public void reportJSException(String instanceId, String function,
                              String exception) {
  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.e("reportJSException >>>> instanceId:" + instanceId
                 + ", exception function:" + function + ", exception:"
                 + exception);
  }
  WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(
      instanceId);
  if (instance != null) {
    // TODO add errCode
    instance.onJSException(null, function, exception);
  }
  WXErrorCode.WX_ERR_JS_EXECUTE.appendErrMsg(exception);
  commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_ERR_JS_EXECUTE);
}