2010-11-12 9 views
0

J'ai l'erreur suivante, quel est le problème? Comment dois-je résoudre ce problème:Erreur: exception non interceptée, pas assez d'argument

**Error:** uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://localhost:90/MARCON/createjob.cfm?job=exists&jobnumber=info10-1 :: <TOP_LEVEL> :: line 704" data: no] 

J'ai ce code, comment puis-je utiliser Send() pour éviter les erreurs ci-dessus?

Ext.lib.Ajax = function() {   
     var activeX = ['MSXML2.XMLHTTP.3.0', 
         'MSXML2.XMLHTTP', 
         'Microsoft.XMLHTTP']; 


     // private 
     function setHeader(o) { 
      var conn = o.conn, 
       prop; 

      function setTheHeaders(conn, headers){ 
       for (prop in headers) { 
        if (headers.hasOwnProperty(prop)) { 
         conn.setRequestHeader(prop, headers[prop]); 
        } 
       } 
      }   

      if (pub.defaultHeaders) { 
       setTheHeaders(conn, pub.defaultHeaders); 
      } 

      if (pub.headers) { 
       setTheHeaders(conn, pub.headers); 
       pub.headers = null;     
      } 
     }  

     // private 
     function createExceptionObject(tId, callbackArg, isAbort, isTimeout) {    
      return { 
       tId : tId, 
       status : isAbort ? -1 : 0, 
       statusText : isAbort ? 'transaction aborted' : 'communication failure', 
        isAbort: true, 
        isTimeout: true, 
       argument : callbackArg 
      }; 
     } 

     // private 
     function initHeader(label, value) {   
      (pub.headers = pub.headers || {})[label] = value;       
     } 

     // private 
     function createResponseObject(o, callbackArg) { 
      var headerObj = {}, 
       headerStr,     
       conn = o.conn;     

      try { 
       headerStr = o.conn.getAllResponseHeaders();     
       Ext.each(headerStr.split('\n'), function(v){ 
        var t = v.indexOf(':'); 
        headerObj[v.substr(0, t)] = v.substr(t + 1); 
       }); 
      } catch(e) {} 

      return { 
       tId : o.tId, 
       status : conn.status, 
       statusText : conn.statusText, 
       getResponseHeader : function(header){return headerObj[header];}, 
       getAllResponseHeaders : function(){return headerStr}, 
       responseText : conn.responseText, 
       responseXML : conn.responseXML, 
       argument : callbackArg 
      }; 
     } 

     // private 
     function releaseObject(o) { 
      o.conn = null; 
      o = null; 
     }   

     // private 
     function handleTransactionResponse(o, callback, isAbort, isTimeout) { 
      if (!callback) { 
       releaseObject(o); 
       return; 
      } 

      var httpStatus, responseObject; 

      try { 
       if (o.conn.status !== undefined && o.conn.status != 0) { 
        httpStatus = o.conn.status; 
       } 
       else { 
        httpStatus = 13030; 
       } 
      } 
      catch(e) { 
       httpStatus = 13030; 
      } 

      if ((httpStatus >= 200 && httpStatus < 300) || (Ext.isIE && httpStatus == 1223)) { 
       responseObject = createResponseObject(o, callback.argument); 
       if (callback.success) { 
        if (!callback.scope) { 
         callback.success(responseObject); 
        } 
        else { 
         callback.success.apply(callback.scope, [responseObject]); 
        } 
       } 
      } 
      else { 
       switch (httpStatus) { 
        case 12002: 
        case 12029: 
        case 12030: 
        case 12031: 
        case 12152: 
        case 13030: 
         responseObject = createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false), isTimeout); 
         if (callback.failure) { 
          if (!callback.scope) { 
           callback.failure(responseObject); 
          } 
          else { 
           callback.failure.apply(callback.scope, [responseObject]); 
          } 
         } 
         break; 
        default: 
         responseObject = createResponseObject(o, callback.argument); 
         if (callback.failure) { 
          if (!callback.scope) { 
           callback.failure(responseObject); 
          } 
          else { 
           callback.failure.apply(callback.scope, [responseObject]); 
          } 
         } 
       } 
      } 

      releaseObject(o); 
      responseObject = null; 
     } 

     // private 
     function handleReadyState(o, callback){ 
     callback = callback || {}; 
      var conn = o.conn, 
       tId = o.tId, 
       poll = pub.poll, 
     cbTimeout = callback.timeout || null; 

      if (cbTimeout) { 
       pub.timeout[tId] = setTimeout(function() { 
        pub.abort(o, callback, true); 
       }, cbTimeout); 
      } 

      poll[tId] = setInterval(
       function() { 
        if (conn && conn.readyState == 4) { 
         clearInterval(poll[tId]); 
         poll[tId] = null; 

         if (cbTimeout) { 
          clearTimeout(pub.timeout[tId]); 
          pub.timeout[tId] = null; 
         } 

         handleTransactionResponse(o, callback); 
        } 
       }, 
       pub.pollInterval); 
     } 

     // private 
     function asyncRequest(method, uri, callback, postData) { 
      var o = getConnectionObject() || null; 

      if (o) { 
       o.conn.open(method, uri, true); 

       if (pub.useDefaultXhrHeader) {      
        initHeader('X-Requested-With', pub.defaultXhrHeader); 
       } 

       if(postData && pub.useDefaultHeader && (!pub.headers || !pub.headers['Content-Type'])){ 
        initHeader('Content-Type', pub.defaultPostHeader); 
       } 

       if (pub.defaultHeaders || pub.headers) { 
        setHeader(o); 
       } 

       handleReadyState(o, callback); 
       o.conn.send(postData || null); 
      } 
      return o; 
     } 

     // private 
     function getConnectionObject() { 
      var o;   

      try { 
       if (o = createXhrObject(pub.transactionId)) { 
        pub.transactionId++; 
       } 
      } catch(e) { 
      } finally { 
       return o; 
      } 
     } 

     // private 
     function createXhrObject(transactionId) { 
      var http; 

      try { 
       http = new XMLHttpRequest();     
      } catch(e) { 
       for (var i = 0; i < activeX.length; ++i) {     
        try { 
         http = new ActiveXObject(activeX[i]);       
         break; 
        } catch(e) {} 
       } 
      } finally { 
       return {conn : http, tId : transactionId}; 
      } 
     } 

     var pub = { 
      request : function(method, uri, cb, data, options) { 
       if(options){ 
        var me = this,     
         xmlData = options.xmlData, 
         jsonData = options.jsonData; 

        Ext.applyIf(me, options);    

        if(xmlData || jsonData){ 
         initHeader('Content-Type', xmlData ? 'text/xml' : 'application/json'); 
         data = xmlData || Ext.encode(jsonData); 
        } 
       }       
       return asyncRequest(method || options.method || "POST", uri, cb, data); 
      }, 

      serializeForm : function(form) { 
       var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements, 
        hasSubmit = false, 
        encoder = encodeURIComponent, 
        element, 
        options, 
        name, 
        val,     
        data = '', 
        type; 

       Ext.each(fElements, function(element) {      
        name = element.name;     
        type = element.type; 

        if (!element.disabled && name){ 
         if(/select-(one|multiple)/i.test(type)){        
          Ext.each(element.options, function(opt) { 
           if (opt.selected) { 
            data += String.format("{0}={1}&",               
                 encoder(name),               
                  (opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttribute('value') !== null) ? opt.value : opt.text); 
           }         
          }); 
         } else if(!/file|undefined|reset|button/i.test(type)) { 
          if(!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)){ 

           data += encoder(name) + '=' + encoder(element.value) + '&';      
           hasSubmit = /submit/i.test(type);  
          }       
         } 
        } 
       });    
       return data.substr(0, data.length - 1); 
      }, 

      useDefaultHeader : true, 
      defaultPostHeader : 'application/x-www-form-urlencoded; charset=UTF-8', 
      useDefaultXhrHeader : true, 
      defaultXhrHeader : 'XMLHttpRequest',   
      poll : {}, 
      timeout : {}, 
      pollInterval : 50, 
      transactionId : 0, 
+1

duplication exacte de [Erreur: exception non interceptée, pas assez d'argument.] (Http://stackoverflow.com/questions/4162592/erroruncaught-exception-not-enoughh-argument). S'il vous plaît ne pas double-poste. –

+0

lol, êtes-vous sérieux? –

Répondre

0

Vous devriez probablement fournir plus d'arguments à l'appel :-) Sans voir, il n'y a pas grand-chose que je peux offrir la source (ligne spécifiquement 704). Au strict minimum, postez cette ligne plus un peu de contexte, disons cinq lignes de chaque côté pour l'instant. Les exceptions (comme dans ce cas) fournissent généralement suffisamment d'informations pour que vous puissiez identifier à la fois le problème et l'emplacement du problème. Vous devez utiliser cette information pour enquêter.

Un coup d'œil rapide sur Google montre que les problèmes se produisent parce que vous utilisez des choses comme:

send(); 
region_Table.insertRow(); 

au lieu de:

send(null); 
region_Table.insertRow(0); 

Une fois que vous postez la ligne incriminée, il devrait être (relativement) facile à comprendre.

+0

@pravin: Et quel type d'élément est-ce exactement? Et quel navigateur? – paxdiablo

+0

JSON, je ne peux malheureusement pas vous aider à suggérer que peut-être le '.value' est incorrect. Marquer CW car ce n'est pas vraiment utile mais je veux m'assurer que personne d'autre ne suit le même chemin (ou, s'ils le font, ils en savent assez pour continuer). – paxdiablo