I am new to programming in general and Javascript specifically I have mostly done Java/PLSQL and some PHP. So if I sound dumb that is why

I have this JS that works sometimes. So sometimes it hits the onSuccess function and life is good. This used to happen all the time. Now about half the time it hits the onException function. I have no idea why.

I have tried everything I can to get the exception name, number, objectname etc. The exception name and number are "undefined" when I try to alert it. When I try to alert the exception itself I get "object". When I try to find the constructor by using e.constructor I get
javascript Code:
function klass()

Here's some of my code:
javascript Code:
        var tokens = new Ajax.Request((XXXXXXXXX)
                onSuccess: function(transport){
                var json = transport.responseText.evalJSON();
                document.getElementById("MODE").value = json.MODE;
                document.getElementById("TKN").value = json.SECURETOKEN;
                document.getElementById("TKNID").value = json.SECURETOKENID;
                onFailure: function(){
                onException: function(e){
                   var exception = e.name;
                    exception += '\n' + e.number;
                  exception += '\n' + e.constructor;
//    alert(e);
                    alert("Exception: " + exception);

Are there any obvious errors? Let me know if I need to post more code.

Are there any tools I can use? I am using Httpfox to see the JSON response from the controller the Ajax request is hitting. Of course when the JS hits the exception there is no JSON response. Instead I get
Error loading content (NS_ERROR_DOCUMENT_NOT_CACHED)