You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2012/04/03 16:03:15 UTC

svn commit: r1308920 - /myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js

Author: werpu
Date: Tue Apr  3 14:03:15 2012
New Revision: 1308920

URL: http://svn.apache.org/viewvc?rev=1308920&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-3521
adding an error handling to our eval, so that the update does not bomb out in case of a js error

Modified:
    myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js

Modified: myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js?rev=1308920&r1=1308919&r2=1308920&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js (original)
+++ myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js Tue Apr  3 14:03:15 2012
@@ -178,6 +178,20 @@ _MF_SINGLTN(_PFX_UTIL + "_Dom", Object, 
             if (finalScripts.length) {
                 _RT.globalEval(finalScripts.join("\n"));
             }
+        } catch (e) {
+            if(window.console && window.console.error) {
+               //not sure if we
+               //should use our standard
+               //error mechanisms here
+               //because in the head appendix
+               //method only a console
+               //error would be raised as well
+               console.error(e.message||e.description);
+            } else {
+                if(jsf.ajax.getProjectStage() === "Development") {
+                    alert("Error in evaluated javascript:"+ (e.message||e.description));
+                }
+            }
         } finally {
             //the usual ie6 fix code
             //the IE6 garbage collector is broken