You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2013/07/23 01:57:30 UTC

[3/8] git commit: Hook requirejs.onError() to present RequireJS errors in the floating console (if enabled)

Hook requirejs.onError() to present RequireJS errors in the floating console (if enabled)


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/2ce0b5a1
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/2ce0b5a1
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/2ce0b5a1

Branch: refs/heads/master
Commit: 2ce0b5a19fcdd4569af5c8b2ebc97d4e8f14803a
Parents: 2ec37ad
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Jul 22 08:57:27 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Jul 22 08:57:27 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/console.coffee           | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2ce0b5a1/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
index 4db2ac5..f5ebb69 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
@@ -126,6 +126,20 @@ define ["./dom", "underscore"],
     # and/or Selenium, it is very useful to present debugging data right on the page.
     window.t5console = exports
 
+    requirejs.onError = (err) ->
+
+      message = "RequireJS error: #{err.requireType}"
+
+      if err.message
+        message += """: #{err.message}"""
+
+      if err.requireType
+        message += """, modules #{err.requireModules.join(", ")}"""
+
+
+      exports.error message
+
+
     # Return the exports; we keep a reference to it, so we can see exports.DURATION, even
     # if some other module imports this one and modifies that property.
     return exports
\ No newline at end of file