Search in sources :

Example 1 with IWXJSExceptionAdapter

use of com.taobao.weex.adapter.IWXJSExceptionAdapter in project weex-example by KalicyZhou.

the class WXBridgeManager method reportJSException.

/**
   * 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());
            }
        }
    }
}
Also used : WXSDKInstance(com.taobao.weex.WXSDKInstance) WXJSExceptionInfo(com.taobao.weex.common.WXJSExceptionInfo) IWXJSExceptionAdapter(com.taobao.weex.adapter.IWXJSExceptionAdapter)

Aggregations

WXSDKInstance (com.taobao.weex.WXSDKInstance)1 IWXJSExceptionAdapter (com.taobao.weex.adapter.IWXJSExceptionAdapter)1 WXJSExceptionInfo (com.taobao.weex.common.WXJSExceptionInfo)1