>But the real issue is the stacktrace one. In this case, the bug could
>have been found by static analysis. But in general, it can not.

I experienced this same issue and tracked it down to a bug in goog, at
least in my case.

In my case, I was making a JSON request to the server. When the
response came back I was throwing an error due to a null reference.
However, the handler code in goog for a JSON request looks something
like this:

goog.events.fireListeners_ = function(map, obj, type, capture, eventObject) {
  var retval = 1;
  var objUid = goog.getUid(obj);
  if(map[objUid]) {
    map.remaining_--;
    var listenerArray = map[objUid];
    if(!listenerArray.locked_) {
      listenerArray.locked_ = 1
    }else {
      listenerArray.locked_++
    }
    try {
      var length = listenerArray.length;
      for(var i = 0;i < length;i++) {
        var listener = listenerArray[i];
        if(listener && !listener.removed) {
          retval &= goog.events.fireListener(listener, eventObject) !== false
        }
      }
    }finally {
      listenerArray.locked_--;
      goog.events.cleanUp_(type, capture, objUid, listenerArray)
    }
  }
  return Boolean(retval)
};

So this basically means that the finally block eats any exceptions
fired by the listeners. I got around this issue by wrapping part of my
response handler in this:

(defn defer-execution [f]
  (js/setTimeout f 1))

This basically bounces the execution context of the function outside
of the finally, and that then allows any exceptions to be logged in
the debugger.

I'm not sure if this helps at all, but it took me about a week (on and
off) to track this issue down.

Timothy

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to