On Dec 2, 2005, at 5:58 PM, Ian Bicking wrote:


Bob Ippolito wrote:
Bob Ippolito wrote:
I've never had too much trouble tracking these sorts of problems
down  in Firefox.  Even doing a try{}catch(e){} will give you an
exception  object that has a traceback in it, so it doesn't really
take long to  figure out what the code path was even without
Venkman's help.


I wasn't aware of this; how do I get to this traceback?


try { asdf } catch (e) { forEach(sorted(items(e)), function (kv) {
writeln(kv.join(": ")); }) }

I thought neat, now I can get the tracebacks I want, I'll just set up a
window.onerror handler... but it doesn't seem to get the exception
object, does it?  Is there any other way to get at it from that event?

Don't think so.

I'm not finding anything in my searching.  A logging function for
exceptions would be nice nevertheless; I might look into that.  And
maybe a little decorator with essentially:

function logErrors(func) {
    function replacement() {
        try {
            return func.apply(this, arguments);
        } catch (e) {
            MochiKit.Logging.logException(e);
            throw;
        }
    }
    return replacement;
}

That would probably be sufficient. Assuming the existence of a function for logging Error instances, anyway.

-bob

Reply via email to