You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ha...@apache.org on 2018/12/06 08:06:55 UTC

[incubator-weex] branch master updated: [jsfm] Still throw caught errors in event handler and callback (#1857)

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

hanks 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 28e5d31  [jsfm] Still throw caught errors in event handler and callback (#1857)
28e5d31 is described below

commit 28e5d31f069a3feefa6cc0ae6c097a17e136e6fa
Author: Hanks <zh...@gmail.com>
AuthorDate: Thu Dec 6 16:06:51 2018 +0800

    [jsfm] Still throw caught errors in event handler and callback (#1857)
    
    Fix #1798
    
    Javascript exceptions should be handled by native engines, catch them in
    the js framework will omit some errors and make it hard to find reasons.
---
 runtime/bridge/CallbackManager.js | 2 ++
 runtime/vdom/Element.js           | 1 +
 2 files changed, 3 insertions(+)

diff --git a/runtime/bridge/CallbackManager.js b/runtime/bridge/CallbackManager.js
index 201560f..80c8fe6 100644
--- a/runtime/bridge/CallbackManager.js
+++ b/runtime/bridge/CallbackManager.js
@@ -67,6 +67,7 @@ export default class CallbackManager {
     }
     catch (e) {
       console.error(`[JS Framework] Failed to execute the hook function on "${key}".`)
+      throw e
     }
     return result
   }
@@ -81,6 +82,7 @@ export default class CallbackManager {
       }
       catch (error) {
         console.error(`[JS Framework] Failed to execute the callback function:\n ${error.toString()}`)
+        throw error
       }
     }
     return new Error(`invalid callback id "${callbackId}"`)
diff --git a/runtime/vdom/Element.js b/runtime/vdom/Element.js
index bf7536c..1745bcb 100644
--- a/runtime/vdom/Element.js
+++ b/runtime/vdom/Element.js
@@ -493,6 +493,7 @@ export default class Element extends Node {
       catch (error) {
         console.error(`[JS Framework] Failed to invoke the event handler of "${type}" `
           + `on ${this.type} (${this.ref}):\n ${error.toString()}`)
+        throw error
       }
     }