You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ky...@apache.org on 2019/04/10 06:47:00 UTC

[incubator-weex] branch master updated: [jsfm] Throw the caught exception in componentHook (#2285)

This is an automated email from the ASF dual-hosted git repository.

kyork pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new c062c8f  [jsfm] Throw the caught exception in componentHook (#2285)
c062c8f is described below

commit c062c8f9431e8862173bad0472bf9429583e6e65
Author: Hanks <zh...@gmail.com>
AuthorDate: Wed Apr 10 14:46:55 2019 +0800

    [jsfm] Throw the caught exception in componentHook (#2285)
    
    Still throw the caught exception in the "componentHook" anyway, it should
    be processed by the native for consistent error collecting.
---
 runtime/bridge/receiver.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/runtime/bridge/receiver.js b/runtime/bridge/receiver.js
index c24cfff..14688ba 100644
--- a/runtime/bridge/receiver.js
+++ b/runtime/bridge/receiver.js
@@ -23,7 +23,8 @@ function fireEvent (document, nodeId, type, event, domChanges, params) {
   const el = document.getRef(nodeId)
   if (el) {
     return document.fireEvent(el, type, event, domChanges, params)
-  } else if (event) {
+  }
+  else if (event) {
     event._nodeId = nodeId
     return document.fireEvent(document.getRef('_documentElement'), type, event, domChanges, params)
   }
@@ -44,6 +45,10 @@ function componentHook (document, componentId, type, hook, args) {
   }
   catch (e) {
     console.error(`[JS Framework] Failed to trigger the "${type}@${hook}" hook on ${componentId}.`)
+
+    // Still throw the exception anyway, it should be caught
+    // and processed by the native for consistent error collecting.
+    throw e
   }
   return result
 }